Move the metagen shortcode block to its own template

This commit is contained in:
Helen Chong 2024-04-14 01:52:18 +08:00
parent 98a9f9aa8d
commit d3d12bcc4c
3 changed files with 13 additions and 20 deletions

View File

@ -7,16 +7,7 @@
{# Meta data #} {# Meta data #}
<meta property="og:title" content="{{ title }}"> <meta property="og:title" content="{{ title }}">
{% metagen {% include "metagen.njk" %}
desc=desc or metadata.desc,
url=url + page.url,
locale=sitemeta.siteLocale,
site_name=sitemeta.siteName,
img=image,
img_alt=alt,
twitter_card_type=type,
twitter_handle=twitter
%}
{# CSS #} {# CSS #}
<link rel="stylesheet" href="{{'/assets/css/main.css' | url | safe}}"> <link rel="stylesheet" href="{{'/assets/css/main.css' | url | safe}}">

11
src/_includes/metagen.njk Normal file
View File

@ -0,0 +1,11 @@
{% metagen
desc=desc or metadata.desc,
url=url + page.url,
locale=sitemeta.siteLocale,
site_name=sitemeta.siteName,
img=image,
img_alt=alt,
twitter_card_type=type,
twitter_handle=twitter,
generator=eleventy.generator
%}

View File

@ -7,16 +7,7 @@
{# Meta data #} {# Meta data #}
<meta property="og:title" content="{% if title %}{{ title }}{% else %}{{ sitemeta.siteName }}{% endif %}"> <meta property="og:title" content="{% if title %}{{ title }}{% else %}{{ sitemeta.siteName }}{% endif %}">
{% metagen {% include "metagen.njk" %}
desc=desc or metadata.desc,
url=url + page.url,
locale=sitemeta.siteLocale,
site_name=sitemeta.siteName,
img=image,
img_alt=alt,
twitter_card_type=type,
twitter_handle=twitter
%}
{# CSS #} {# CSS #}
<link rel="stylesheet" href="{{'/assets/css/index.css' | url | safe}}"> <link rel="stylesheet" href="{{'/assets/css/index.css' | url | safe}}">