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

Use page specific title and description in meta values #2466

Merged
merged 2 commits into from
Feb 23, 2024
Merged
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
25 changes: 19 additions & 6 deletions _includes/meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,28 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Title and meta description
================================================== -->
<title>{{site.title}} - {{ page.title}}</title>
<meta property="og:title" content="{{site.title}}">
<meta name="description" content="{{site.description}}">
<meta property="og:description" content="{{site.description}}">
{% capture title %}
{%- if page.title -%}{{- page.title | strip_html }} | {% endif -%}{{ site.title -}}
Copy link
Contributor

@sknep sknep Feb 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you interested in inserting "Pages" for the part of the site that's specific to Pages?

Wait, there is Pages in there. How do those pages look now?

{% endcapture %}
{% capture description %}
{%- if page.url == "/" -%}
{{- site.description -}}
{%- elsif page.description -%}
{{- page.description | truncate: 160 -}}
{%- else -%}
{{- page.content | markdownify | strip_html | normalize_whitespace | strip | truncate: 160 -}}
{%- endif -%}
{% endcapture %}

<title>{{title}}</title>
<meta property="og:title" content="{{title}}">
<meta name="description" content="{{description}}">
<meta property="og:description" content="{{description}}">

<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@{{site.twitter}}" />
<meta name="twitter:title" content="{{site.title}}" />
<meta name="twitter:description" content="{{site.description}}" />
<meta name="twitter:title" content="{{title}}" />
<meta name="twitter:description" content="{{description}}" />
<meta name="google-site-verification" content="JlbE7awT0VhzUvlXbc1wO1yhfFme3lSE1ViUmFX6EEY" />

<meta property="og:type" content="article">
Expand Down
Loading