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

WIP: Og image alt #3563

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ facebook:
app_id :
publisher :
og_image : # Open Graph/Twitter default site image
og_image_alt : # Alternative text for Open Graph/Twitter image for screen readers
# For specifying social profiles
# - https://developers.google.com/structured-data/customize/social-profiles
social:
Expand Down
5 changes: 5 additions & 0 deletions _includes/seo.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
{%- assign site_og_image = site.og_image | absolute_url -%}
{%- assign site_og_image = site_og_image | escape -%}

{%- assign site_og_image_alt = site.og_image_alt -%}
{%- assign site_og_image_alt = site_og_image_alt | escape -%}

{%- if page.date -%}
{%- assign og_type = "article" -%}
{%- else -%}
Expand Down Expand Up @@ -71,6 +74,7 @@
<meta property="og:image" content="{{ page_large_image }}">
{% elsif page_teaser_image %}
<meta property="og:image" content="{{ page_teaser_image }}">
<meta property="og:image:alt" content="{{ site_og_image_alt }}">
{% endif %}

{% if site.twitter.username %}
Expand All @@ -86,6 +90,7 @@
<meta name="twitter:card" content="summary">
{% if page_teaser_image %}
<meta name="twitter:image" content="{{ page_teaser_image }}">
<meta property="twitter:image:alt" content="{{ site_og_image_alt }}">
{% endif %}
{% endif %}

Expand Down
1 change: 1 addition & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ facebook:
app_id :
publisher :
og_image : "/assets/images/site-logo.png" # Open Graph/Twitter default site image
og_image_alt : "Minimal mistakes logo" # Alternative text for screen readers
# For specifying social profiles, used in _includes/seo.html
# - https://developers.google.com/structured-data/customize/social-profiles
social:
Expand Down