Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post preview for Twitter #6

Open
vrde opened this issue Jan 30, 2020 · 5 comments
Open

Post preview for Twitter #6

vrde opened this issue Jan 30, 2020 · 5 comments

Comments

@vrde
Copy link
Member

vrde commented Jan 30, 2020

I don't see any Twitter card metadata in the blog post HTML. I guess we have to install a plugin, but I don't find any in the Hexo Plugin page.

Ideas?

@TimDaub
Copy link
Member

TimDaub commented Jan 31, 2020

I found: https://www.npmjs.com/package/hexo-plugin-social

Additionally, any hexo .md file also supports full HTML. So if Twitter e.g. as an <embed tag, we could use that too.

@vrde
Copy link
Member Author

vrde commented Jan 31, 2020

Oh I want to do the opposite. When sharing a blog post on Twitter I'd like to see the card preview in the tweet.

@TimDaub
Copy link
Member

TimDaub commented May 6, 2020

Screen Shot 2020-05-06 at 12 10 41

Apparently my blog has some way to generate previews. I'm not sure what addon it is. We could try:

  • "hexo-generator-index": "^1.0.0"
  • "hexo-generator-seo-friendly-sitemap": "0.0.25"
  • "hexo-tag-owl": "^1.2.2"
  • "hexo-tag-twitter": "^1.0.1"

@TimDaub
Copy link
Member

TimDaub commented Feb 14, 2021

Hexo allows adding open graph protocol tags to templates using the open_graph function.

<%- open_graph({title: page.title, image: page.image}) %>

Can be added to the post template. The yml section on top of every .md post allows adding properties to the page object.

@TimDaub
Copy link
Member

TimDaub commented Feb 14, 2021

Using twitter_card: "summary_large_image", the following can be achieved:

Screen Shot 2021-02-14 at 17 02 06

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants