CaiJimmy / hugo-theme-stack

Card-style Hugo theme designed for bloggers
https://stack.jimmycai.com
GNU General Public License v3.0
4.89k stars 1.6k forks source link

Add og:title tag option. #874

Closed MofuMoca closed 6 months ago

MofuMoca commented 1 year ago

More introduction in commit comment. TL;DL Add an option to choose og:title will be "Title" or "Title - SiteName".

vercel[bot] commented 1 year ago

Someone is attempting to deploy a commit to a Personal Account owned by @CaiJimmy on Vercel.

@CaiJimmy first needs to authorize it.

CaiJimmy commented 11 months ago

Thanks for the PR! And sorry for the late reply 🙏.

For sites that respect the OpenGraph standard and display og:site, would this feature cause the site title to appear twice if it's enabled?

ottok commented 11 months ago

Should you perhaps use git rebase -i to squash the two commits into one and write the commit message in English?

MofuMoca commented 11 months ago

Thanks for the PR! And sorry for the late reply 🙏.

For sites that respect the OpenGraph standard and display og:site, would this feature cause the site title to appear twice if it's enabled?

Yes and no. But I think this will not be a bad side effect.

There are some use case for me. image At plurk.com will not show og:site_name.

image Here are mastodon.

image FaceBook will show URL instand of og:site_name.

image Finally discord is similar to mastodon.

Edit: image I fogout the Telegram.Hmmm...Telegram link preview works well? Show the og:site_name and in og:title deleted site name that after title...?

2nd Edit; Also forgot Twitter(or call X?). For <meta name="twitter:card" content="summary_large_image"> image Hmmmm. Just a Image.Got it.

There are <meta name="twitter:card" content="summary"> image

Should you perhaps use git rebase -i to squash the two commits into one and write the commit message in English?

Thank for advice. I will do rebase later if my PR has been accept ,should I recreate a new PR? And the commit message I write down in English after Chinese. There are the same context.

ottok commented 11 months ago

Thanks for the clarifying pictures.

If you change the code or commits, you should not open a new PR but simply update this one with git push or git --force push.

MofuMoca commented 11 months ago

Thanks alot. Sorry for too many force-push, something wrong with my gpg key. All are done.

ottok commented 7 months ago

I am not sure if this is needed? At least on my site the title for front page and for posts works correctly as expected:

Front page: <meta property='og:title' content='Optimized by Otto'>

Post page: <meta property='og:title' content='Learn to write better git commit messages by example'>

CaiJimmy commented 6 months ago

I am not sure if this is needed? At least on my site the title for front page and for posts works correctly as expected:

Front page: <meta property='og:title' content='Optimized by Otto'>

Post page: <meta property='og:title' content='Learn to write better git commit messages by example'>

@ottok The problem is that some sites do not read og:site_name and use only og:title. Adding this feature forces the site title to be included in og:title.

But in my opinion this is a really rare use case and would affect sites that respect the OpenGraph standard. Besides, this fix can be achieved by overriding the template. So I'm going to reject this PR. Sorry @MofuMoca for taking so long to decide 🙏 .