-
Notifications
You must be signed in to change notification settings - Fork 25.6k
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
provide (stronger) per-page override for og:image
#1316
Comments
So that I understand the feature request correctly... Let's say you have Is that correct? If so that's pretty much what #943 requested. I'm not really interested in making changes to the SEO.html include as I plan on dropping it and falling back to jekyll-seo-tag instead. Much of those other issues are related to not having a header image defined for the page... which is used for |
I'd say this is correct, although from my reading of #943, it wouldn't have been possible (putting the I wasn't aware of that jekyll-seo-tag feature, I'll look into it, so that I'm ready for switching to it (at a quick glance, it does seem to have nice features!). Until then, I might make a local change to I've certainly experienced the behaviour of Facebook taking whatever image it thinks is appropriate when it scrapes the page, if no It is nice to be able to provide a sensible default, though, so the current behaviour (of Minimal Mistakes using the Thanks for your help! |
The Jekyll SEO Tag Plugin is pretty nice. The only reason I haven't switched over to it yet are due to some breaking changes. It isn't that big of a deal, but it would require changing some YAML Front Matter in your posts as it looks for I haven't looked at seo.html in some time, looks like there's opportunity to dry up the code. Specifically around {% if page.header.image %}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="{% if page.header.image contains "://" %}{{ page.header.image }}{% else %}{{ page.header.image | absolute_url }}{% endif %}">
{% else %}
<meta name="twitter:card" content="summary">
{% if page.header.teaser %}
<meta name="twitter:image" content="{% if page.header.teaser contains "://" %}{{ page.header.teaser }}{% else %}{{ page.header.teaser | absolute_url }}{% endif %}">
{% elsif site.og_image %}
<meta name="twitter:image" content="{{ site.og_image | absolute_url }}">
{% endif %}
{% endif %}
{% if page.header.image %}
<meta property="og:image" content="{% if page.header.image contains "://" %}{{ page.header.image }}{% else %}{{ page.header.image | absolute_url }}{% endif %}">
{% elsif page.header.overlay_image %}
<meta property="og:image" content="{% if page.header.overlay_image contains "://" %}{{ page.header.overlay_image }}{% else %}{{ page.header.overlay_image | absolute_url }}{% endif %}">
{% elsif page.header.teaser %}
<meta property="og:image" content="{% if page.header.teaser contains "://" %}{{ page.header.teaser }}{% else %}{{ page.header.teaser | absolute_url }}{% endif %}">
{% elsif site.og_image %}
<meta property="og:image" content="{% if site.og_image contains "://" %}{{ site.og_image }}{% else %}{{ site.og_image | absolute_url }}{% endif %}">
{% endif %} I think I can do some smart things there, which could make the feature you're requesting trivial and easy to add. |
If I'd do it locally, I'd just change the But I'll keep an eye on if you do anything here, too. 😃 |
I'm not Jekyll expert, and even worse of a web designer, by the way! My strength is more in backend services. 😛 But I see what you mean with the DRY, you can do the image selection once, assign it to something, and then do the meta tags once, using that variable... |
DRY up handling of page images (`page.header.image`, `page.header.overlay_image`, `page.header.teaser`, and `site.og_image`). Allow page images to be set with `header.og_image` page variable in YAML Front Matter as per feature request in #1316.
This feature has been added to How this works is if you set a header or overlay image for a page those are used by default for OG or Twitter Cards. You can override those by setting header:
image: /assets/images/your-page-image.jpg
og_image: /assets/images/your-og-image.jpg |
Thanks! |
- Refactor seo.html include and add `page.header.og_image` override - DRY up handling of page images (`page.header.image`, `page.header.overlay_image`, `page.header.teaser`, and `site.og_image`). - Allow page images to be set with `header.og_image` page variable in YAML Front Matter as per feature request in mmistakes#1316. - Add sample posts for testing `og_image` override - Set author bio as site OpenGraph default image - Document `page.header.og_image` OpenGraph override - Update CHANGELOG and history Close mmistakes#1316
- Refactor seo.html include and add `page.header.og_image` override - DRY up handling of page images (`page.header.image`, `page.header.overlay_image`, `page.header.teaser`, and `site.og_image`). - Allow page images to be set with `header.og_image` page variable in YAML Front Matter as per feature request in mmistakes#1316. - Add sample posts for testing `og_image` override - Set author bio as site OpenGraph default image - Document `page.header.og_image` OpenGraph override - Update CHANGELOG and history Close mmistakes#1316
- Refactor seo.html include and add `page.header.og_image` override - DRY up handling of page images (`page.header.image`, `page.header.overlay_image`, `page.header.teaser`, and `site.og_image`). - Allow page images to be set with `header.og_image` page variable in YAML Front Matter as per feature request in mmistakes#1316. - Add sample posts for testing `og_image` override - Set author bio as site OpenGraph default image - Document `page.header.og_image` OpenGraph override - Update CHANGELOG and history Close mmistakes#1316
bundle update
.bundle exec jekyll build
.Environment informations
Expected behavior
With a
splash
page layout, it usually makes sense for theimage
oroverlay_image
to be of a fairly wide aspect ratio, similar to what would be used on a Facebook cover photo. But theog:image
property, when used for sharing on Facebook, appears to cropped to something closer to a square aspect ratio?So I'm thinking it might make sense to be able to easily override the
og:image
for splash pages, to provide a better image for the sharing preview. Maybe apage.og_image
that would be the "first preference" for settingog:image
in theseo.html
file?Steps to reproduce the behavior
Here's an example on a site I created recently.
Source: https://github.com/Pro10RacingUK/Pro10RacingUK.github.io/blob/master/index.html
Web page: https://pro10racing.co.uk/
Sharing in a post is not too bad (after I left a lot of white space above and below in the picture used with
overlay_image
, that is, if I made it tight, it didn't look right either):When sharing as a comment, it gets cropped more square:
The text was updated successfully, but these errors were encountered: