change meta structure

This commit is contained in:
madrilene 2024-01-31 10:54:16 +01:00
parent 693c1a84b2
commit 56e10a5591
8 changed files with 35 additions and 34 deletions

View file

@ -7,21 +7,23 @@ module.exports = {
locale: 'en_EN', locale: 'en_EN',
lang: 'en', lang: 'en',
skipContent: 'Skip to content', skipContent: 'Skip to content',
author: 'Lene Saile', // i.e. Lene Saile - page / blog author's name. Must be set. author: {
authorAvatar: '/favicon.png', // for h-card, defaults to favicon name: 'Lene Saile', // i.e. Lene Saile - page / blog author's name. Must be set.
authorEmail: '', // i.e. hola@lenesaile.com - email of the author avatar: '/favicon.png',
authorWebsite: '', // i.e. https.://www.lenesaile.com - the personal site of the author email: 'hola@lenesaile.com', // i.e. hola@lenesaile.com - email of the author
creator: 'Lene Saile', // i.e. Lene Saile - creator's (developer) name. website: 'https.://www.lenesaile.com' // i.e. https.://www.lenesaile.com - the personal site of the author
creatorEmail: 'hola@lenesaile.com', // i.e. hola@lenesaile.com },
creatorWebsite: 'https://www.lenesaile.com', // i.e. https.://www.lenesaile.com creator: {
creatorSocial: 'https://front-end.social/@lene', // i.e. https.://www.lenesaile.com name: 'Lene Saile', // i.e. Lene Saile - creator's (developer) name.
email: 'hola@lenesaile.com',
website: 'https://www.lenesaile.com',
social: 'https://front-end.social/@lene'
},
themeColor: '#DD4462', // Manifest: defines the default theme color for the application themeColor: '#DD4462', // Manifest: defines the default theme color for the application
themeBgColor: '#FBFBFB', // Manifest: defines a placeholder background color for the application page to display before its stylesheet is loaded themeBgColor: '#FBFBFB', // Manifest: defines a placeholder background color for the application page to display before its stylesheet is loaded
meta_data: { opengraph_default: '/assets/images/template/opengraph-default.jpg', // fallback/default meta image
opengraph_default: '/assets/images/template/opengraph-default.jpg', // fallback/default meta image opengraph_default_alt:
opengraph_default_alt: 'Visible content: Eleventy starter based on workflow for Cube CSS, Every Layout, Design Tokens and Tailwind for uitility, based on the concepts explained in buildexcellentwebsit.es', // alt text for default meta image
'Visible content: Eleventy starter based on workflow for Cube CSS, Every Layout, Design Tokens and Tailwind for uitility, based on the concepts explained in buildexcellentwebsit.es' // alt text for default meta image
},
blog: { blog: {
// this is for the rss feed // this is for the rss feed
name: 'My Web Development Blog', name: 'My Web Development Blog',

View file

@ -48,12 +48,12 @@
content="{{ meta.url }}{% if (layout == 'post') %}/assets/og-images/{{ content="{{ meta.url }}{% if (layout == 'post') %}/assets/og-images/{{
title | slugify title | slugify
}}-preview.jpeg }}-preview.jpeg
{% else %}{{ meta.meta_data.opengraph_default }} {% else %}{{ meta.opengraph_default }}
{% endif %}" {% endif %}"
/> />
<meta <meta
property="og:image:alt" property="og:image:alt"
content="{% if (layout == 'post') %}{% else %}{{ meta.meta_data.opengraph_default_alt }} content="{% if (layout == 'post') %}{% else %}{{ meta.opengraph_default_alt }}
{% endif %}" {% endif %}"
/> />
<meta <meta
@ -64,7 +64,7 @@
/> />
<meta property="og:site_name" content="{{ meta.siteName }}" /> <meta property="og:site_name" content="{{ meta.siteName }}" />
<meta property="og:locale" content="{{ meta.locale }}" /> <meta property="og:locale" content="{{ meta.locale }}" />
<meta property="article:author" content="{{ meta.author }}" /> <meta property="article:author" content="{{ meta.author.name }}" />
<!-- Twitter specific head data was removed in v2 --> <!-- Twitter specific head data was removed in v2 -->

View file

@ -11,16 +11,16 @@
"@id": "{{ url }}", "@id": "{{ url }}",
"headline": "{{ title or meta.siteName }}", "headline": "{{ title or meta.siteName }}",
"description": "{{ discover.description or description or meta.siteDescription }}", "description": "{{ discover.description or description or meta.siteDescription }}",
"image": "{{ meta.url }}{% if discover.image %}/assets/images/{{ discover.image }}{% else %}{{ meta.meta_data.opengraph_default }}{% endif %}", "image": "{{ meta.url }}{% if discover.image %}/assets/images/{{ discover.image }}{% else %}{{ meta.opengraph_default }}{% endif %}",
"inLanguage": "{{ meta.locale }}", "inLanguage": "{{ meta.locale }}",
"publisher": { "publisher": {
"@type": "{{ meta.siteType }}", "@type": "{{ meta.siteType }}",
"name": "{{ meta.author }}", "name": "{{ meta.author.name }}",
"url": "{{ meta.url }}" "url": "{{ meta.url }}"
}, },
"author": { "author": {
"@type": "Person", "@type": "Person",
"name": "{{ meta.author }}" "name": "{{ meta.author.name }}"
}, },
"datePublished": "{{ date | toIsoString }}" "datePublished": "{{ date | toIsoString }}"
} }

View file

@ -35,11 +35,11 @@ schema: blog
<!-- h-card infos: https://indieweb.org/authorship --> <!-- h-card infos: https://indieweb.org/authorship -->
<div hidden class="h-entry"> <div hidden class="h-entry">
<a class="u-url" href="{{ page.url | url | absoluteUrl(meta.url) }}">{{ title }}</a> <a class="u-url" href="{{ page.url | url | absoluteUrl(meta.url) }}">{{ title }}</a>
<a class="p-name u-url" rel="author" href="{{ meta.url }}">{{ meta.author }}</a> <a class="p-name u-url" rel="author" href="{{ meta.url }}">{{ meta.author.name }}</a>
<img <img
class="u-author h-card" class="u-author h-card"
src="{{ meta.authorAvatar | url | absoluteUrl(meta.url) }}" src="{{ meta.author.avatar | url | absoluteUrl(meta.url) }}"
alt="{{ meta.author }}" alt="{{ meta.author.name }}"
/> />
</div> </div>
</article> </article>

View file

@ -12,4 +12,4 @@ noindex: true
[Please try visiting the home page!](/) [Please try visiting the home page!](/)
Please let me know if you encounter more errors: Please let me know if you encounter more errors:
<a href="mailto:{{ meta.creatorEmail }}">{{ meta.creatorEmail }}</a> <a href="mailto:{{ meta.creator.email }}">{{ meta.creator.email }}</a>

View file

@ -13,8 +13,8 @@ excludeFromSitemap: true
<updated>{{ postslist | getNewestCollectionItemDate | dateToRfc3339 }}</updated> <updated>{{ postslist | getNewestCollectionItemDate | dateToRfc3339 }}</updated>
<id>{{ meta.url }}/</id> <id>{{ meta.url }}/</id>
<author> <author>
<name>{{ meta.author }}</name> <name>{{ meta.author.name }}</name>
<email>{{ meta.authorEmail }}</email> <email>{{ meta.author.email }}</email>
</author> </author>
{%- for post in postslist %} {%- set absolutePostUrl = post.url | absoluteUrl(meta.url) {%- for post in postslist %} {%- set absolutePostUrl = post.url | absoluteUrl(meta.url)
%} %}

View file

@ -3,13 +3,12 @@ permalink: /humans.txt
eleventyExcludeFromCollections: true eleventyExcludeFromCollections: true
excludeFromSitemap: true excludeFromSitemap: true
--- ---
/* TEAM */ /* TEAM */
Developer: {{ meta.creator }} Developer: {{ meta.creator.name }}
Contact: {{ meta.creatorEmail }} Contact: {{ meta.creator.email }}
Site: {{ meta.creatorWebsite }} Site: {{ meta.creator.website }}
{% if meta.creatorSocial %} {% if meta.creator.social %}
Find me on: {{ meta.creatorSocial }}{% endif %} Find me on: {{ meta.creator.social }}{% endif %}
/* SITE */ /* SITE */
Doctype: HTML5 Doctype: HTML5

View file

@ -21,12 +21,12 @@ The fallback and default image for all other pages is the image set as `opengrap
<meta <meta
property="og:image" property="og:image"
content="{{ meta.url }} content="{{ meta.url }}
{% if (layout == 'post') %}/assets/images/social-preview/{{ title | slugify }}-preview.jpeg {% if (layout == 'post') %}/assets/og-images/{{ title | slugify }}-preview.jpeg
{% else %}{{ meta.meta_data.opengraph_default }} {% else %}{{ meta.opengraph_default }}
{% endif %}" {% endif %}"
/> />
``` ```
{% endraw %} {% endraw %}
To change the look and behaviour of those images and replace the SVG background edit `src/social-preview.njk`. The implementation is based on [Bernard Nijenhuis article](https://bnijenhuis.nl/notes/automatically-generate-open-graph-images-in-eleventy/). To change the look and behaviour of those images and replace the SVG background edit `src/common/og-images.njk`. The implementation is based on [Bernard Nijenhuis article](https://bnijenhuis.nl/notes/automatically-generate-open-graph-images-in-eleventy/).