new folder "common" for all important "common" files

This commit is contained in:
madrilene 2024-01-30 18:21:41 +01:00
parent 3dac465733
commit 6cdf9e3799
12 changed files with 284 additions and 73 deletions

View file

@ -1,5 +1,5 @@
---
title: Not Found
title: No encontrado
layout: page
permalink: /404.html
eleventyExcludeFromCollections: true
@ -7,9 +7,9 @@ excludeFromSitemap: true
noindex: true
---
## Sorry, that page doesn't exist!
## Lo sentimos, ¡esa página no existe!
[Please try visiting the home page!](/)
[Recomendamos visitar la página de inicio.](/)
Please let me know if you encounter more errors:
Por favor, infórmanos de cualquier error que encuentres:
<a href="mailto:{{ meta.address.email }}">{{ meta.address.email }}</a>

12
src/common/_redirects.njk Normal file
View file

@ -0,0 +1,12 @@
---
permalink: /_redirects
eleventyExcludeFromCollections: true
excludeFromSitemap: true
---
{% for page in collections.all %}
{% if page.url and page.data.redirectFrom %}
{% for oldUrl in page.data.redirectFrom %}
{{ oldUrl }} {{ page.url }}
{% endfor %}
{% endif %}
{% endfor %}

14
src/common/carbon.njk Normal file
View file

@ -0,0 +1,14 @@
---
permalink: /carbon.txt
eleventyExcludeFromCollections: true
excludeFromSitemap: true
---
[upstream]
providers = [{ domain = {{meta.greenweb.providers.domain}}, service = {{meta.greenweb.providers.service}} }]
[org]
credentials = [
{% if meta.greenweb.credentials.domain %}
{ domain = {{ meta.greenweb.credentials.domain }}, doctype = {{meta.greenweb.credentials.doctype }}, url = {{meta.greenweb.credentials.url }} }
{% endif %} ]
# more info: https://carbontxt.org/

15
src/common/humans.njk Normal file
View file

@ -0,0 +1,15 @@
---
permalink: /humans.txt
eleventyExcludeFromCollections: true
excludeFromSitemap: true
---
/* TEAM */
Developer: {{ meta.creator }}
Contact: {{ meta.creatorEmail }}
Site: {{ meta.creatorWebsite }}
{% if meta.creatorSocial %}
Find me on: {{ meta.creatorSocial }}{% endif %}
/* SITE */
Doctype: HTML5

114
src/common/og-images.njk Normal file
View file

@ -0,0 +1,114 @@
---
font: Ubuntu # TODO: find a way for the hosting provider to provide the font on build
background: 'white'
text: '#211715'
waveSteps: 10
amplitude: 35
waveHeight: 0.33
colors: ['#e7c803', '#f58050', '#f0505a', '#f050c8']
pagination:
data: collections.posts
size: 1
alias: post
permalink: '/assets/og-images/{{ post.data.title | slugify }}-preview.svg'
eleventyExcludeFromCollections: true
---
<svg
width="1200"
height="630"
viewBox="0 0 1200 630"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
{% set titleInLines = post.data.title | splitlines(20) %}
{% set numberOfLines = titleInLines.length %}
{% if numberOfLines == 1 %}
{% set verticalStartingPoint = 340 %}
{% elseif numberOfLines == 2 %}
{% set verticalStartingPoint = 290 %}
{% elseif numberOfLines == 3 %}
{% set verticalStartingPoint = 250 %}
{% elseif numberOfLines == 4 %}
{% set verticalStartingPoint = 210 %}
{% elseif numberOfLines == 5 %}
{% set verticalStartingPoint = 170 %}
{% endif %}
<!-- SVG background, generate your own on: https://app.haikei.app/ or https://pattern.monster/ -->
<svg id="patternId" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="a" patternUnits="userSpaceOnUse" width="40" height="80" patternTransform="scale(2) rotate(0)">
<rect x="0" y="0" width="100%" height="100%" fill="{{ background }}" />
<path
d="M-4.798 13.573C-3.149 12.533-1.446 11.306 0 10c2.812-2.758 6.18-4.974 10-5 4.183.336 7.193 2.456 10 5 2.86 2.687 6.216 4.952 10 5 4.185-.315 7.35-2.48 10-5 1.452-1.386 3.107-3.085 4.793-4.176"
stroke-width="2"
stroke="{{ colors[0] }}"
fill="none"
/>
<path
d="M-4.798 33.573C-3.149 32.533-1.446 31.306 0 30c2.812-2.758 6.18-4.974 10-5 4.183.336 7.193 2.456 10 5 2.86 2.687 6.216 4.952 10 5 4.185-.315 7.35-2.48 10-5 1.452-1.386 3.107-3.085 4.793-4.176"
stroke-width="2"
stroke="{{ colors[1] }}"
fill="none"
/>
<path
d="M-4.798 53.573C-3.149 52.533-1.446 51.306 0 50c2.812-2.758 6.18-4.974 10-5 4.183.336 7.193 2.456 10 5 2.86 2.687 6.216 4.952 10 5 4.185-.315 7.35-2.48 10-5 1.452-1.386 3.107-3.085 4.793-4.176"
stroke-width="2"
stroke="{{ colors[2] }}"
fill="none"
/>
<path
d="M-4.798 73.573C-3.149 72.533-1.446 71.306 0 70c2.812-2.758 6.18-4.974 10-5 4.183.336 7.193 2.456 10 5 2.86 2.687 6.216 4.952 10 5 4.185-.315 7.35-2.48 10-5 1.452-1.386 3.107-3.085 4.793-4.176"
stroke-width="2"
stroke="{{ colors[3] }}"
fill="none"
/>
</pattern>
</defs>
<rect width="800%" height="800%" transform="translate(0,0)" fill="url(#a)"/>
</svg>
<rect id="bg" width="100%" height="100%" opacity="0.7" fill="{{ background }}"/>
<rect id="name-bg" width="100%" height="42px" fill="{{ background }}" stroke="{{ text }}" stroke-width="0.1" transform="translate(150,550)" />
<!-- date -->
<text
font-family="{{ font }}, sans-serif"
font-size="24"
font-weight="700"
fill="{{ text }}"
letter-spacing="-1"
>
<tspan x="160" y="{{ verticalStartingPoint - 120 }}">
{{ post.date | formatDate('DD / MM / YYYY') }}
</tspan>
</text>
<!-- title -->
<text
id="text"
font-family="{{ font }}, sans-serif"
font-size="80"
font-weight="700"
fill="{{ text }}"
letter-spacing="-3"
>
{% for line in titleInLines %}
<tspan x="160" y="{{ verticalStartingPoint - 20 + loop.index0 * 85 }}">
{{ line }}
</tspan>
{% endfor %}
</text>
<!-- sitename -->
<text
font-family="{{ font }}, sans-serif"
font-size="24"
font-weight="bold"
fill="{{ text }}"
letter-spacing="-0.5"
>
<tspan x="160" y="580">{{ meta.siteName }} · {{ meta.url | replace("https://", "") | replace("http://", "") }}</tspan>
</text>
</svg>

6
src/common/robots.njk Normal file
View file

@ -0,0 +1,6 @@
---
permalink: /robots.txt
eleventyExcludeFromCollections: true
excludeFromSitemap: true
---
User-agent: * Disallow: /404.html Sitemap: {{ meta.url }}/sitemap.xml

View file

@ -0,0 +1,31 @@
---
permalink: /site.webmanifest
eleventyExcludeFromCollections: true
excludeFromSitemap: true
---
{
"name": "{{ meta.siteName }} - {{ meta.siteDescription }}",
"short_name": "{{ meta.siteName }}",
"start_url": "{{ meta.url }}",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "/maskable.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
],
"theme_color": "{{ meta.themeColor }}",
"background_color": "{{ meta.themeBgColor }}",
"display": "standalone"
}

21
src/common/sitemap.njk Normal file
View file

@ -0,0 +1,21 @@
---
permalink: /sitemap.xml
eleventyExcludeFromCollections: true
excludeFromSitemap: true
---
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% for page in collections.onlyMarkdown %}
{% if page.url and page.data.excludeFromSitemap != true %}
{% if page.data.lastUpdated %}{% set lastmod = page.data.lastUpdated %}
{% else %}{% set lastmod = page.date %}
{% endif %}
<url>
<loc>{{ meta.url }}{{ page.url }}</loc>
<lastmod>{{ lastmod | toIsoString }}</lastmod>
</url>
{% endif %}
{% endfor %}
</urlset>

42
src/common/tagList.njk Normal file
View file

@ -0,0 +1,42 @@
---
layout: tags
pagination:
data: collections
size: 1
alias: tag
permalink: /tags/{{ tag }}/
eleventyComputed:
title: '{{ meta.blog.tagSingle }}: {{ tag }}'
---
<ul class="taglist | my-s-m cluster" role="list">
{% for tag in collections.tagList %}
<li><a
href="/tags/{{ tag }}"
class="button"
{{
helpers.getLinkActiveState('/tags/' + tag,
page.url)
|
safe
}}
>
{{ tag }}
</a></li>
{% endfor %}
</ul>
<ul class="grid region" role="list" data-rows="masonry" data-layout="50-50">
<!-- loop posts -->
{% set itemList = collections[tag] | reverse %} {% for item in itemList %}
<!-- activate tags -->
{% set activateTags = true %}
<!-- set heading context -->
{% set headingContext = "h2" %}
<!-- card -->
{% include 'components/card.njk' %} {% endfor %}
</ul>

25
src/common/tags.njk Normal file
View file

@ -0,0 +1,25 @@
---
layout: tags
permalink: /tags/index.html
eleventyComputed:
title: '{{ meta.blog.tagPlural }}'
---
<div class="taglist | my-s-m cluster">
{% for tag in collections.tagList %}
<a href="/tags/{{ tag }}" class="button">
{{ tag }}
</a>
{% endfor %}
</div>
<ul class="grid region" role="list" data-rows="masonry" data-layout="50-50">
<!-- loop posts -->
{% set itemlist = collections.posts %} {% for item in itemlist %}
<!-- activate tags -->
{% set activateTags = true %}
<!-- set heading context -->
{% set headingContext = "h2" %}
<!-- card -->
{% include 'components/card.njk' %} {% endfor %}
</ul>

View file

@ -1,69 +0,0 @@
---
# https://github.com/bnijenhuis/bnijenhuis-nl/blob/main/social-preview.njk
pagination:
data: collections.posts
size: 1
alias: preview
permalink: '/assets/images/social-preview/{{ preview.data.title | slugify }}-preview.svg'
eleventyExcludeFromCollections: true
---
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="1200" height="628" viewBox="0 0 1200 628" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
>
{% set titleInLines = preview.data.title | splitlines(16) %}
{% set numberOfLines = titleInLines.length %}
{% if numberOfLines == 1 %}
{% set verticalStartingPoint = 340 %}
{% elseif numberOfLines == 2 %}
{% set verticalStartingPoint = 290 %}
{% elseif numberOfLines == 3 %}
{% set verticalStartingPoint = 250 %}
{% elseif numberOfLines == 4 %}
{% set verticalStartingPoint = 210 %}
{% elseif numberOfLines == 5 %}
{% set verticalStartingPoint = 170 %}
{% endif %}
<!-- SVG background, generate your own on: https://app.haikei.app/ -->
<svg id="visual" viewBox="0 0 1200 628" width="1200" height="628" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"><rect x="0" y="0" width="1200" height="628" fill="#F3F3F3"></rect><path d="M0 100L50 92.7C100 85.3 200 70.7 300 70.7C400 70.7 500 85.3 600 94.3C700 103.3 800 106.7 900 107.5C1000 108.3 1100 106.7 1150 105.8L1200 105L1200 0L1150 0C1100 0 1000 0 900 0C800 0 700 0 600 0C500 0 400 0 300 0C200 0 100 0 50 0L0 0Z" fill="#DD4462" stroke-linecap="round" stroke-linejoin="miter"></path></svg>
<!-- date -->
<text
font-family="Redhat, Roboto, 'Helvetica Neue', sans-serif"
font-size="24"
font-weight="bold"
fill="#DD4462"
letter-spacing="-1"
>
<tspan x="160" y="{{ verticalStartingPoint - 120 }}">
{{ preview.date | formatDate('DD / MM / YYYY') }}
</tspan>
</text>
<!-- title -->
<text
id="text"
font-family="Redhat, Roboto, 'Helvetica Neue', sans-serif"
font-size="80"
font-weight="900"
fill="#333333"
letter-spacing="-3"
>
{% for line in titleInLines %}
<tspan x="160" y="{{ verticalStartingPoint - 20 + loop.index0 * 80 }}">
{{ line }}
</tspan>
{% endfor %}
</text>
<!-- sitename -->
<text
font-family="Redhat, Roboto, 'Helvetica Neue', sans-serif"
font-size="24"
font-weight="bold"
fill="#DD4462"
letter-spacing="-0.5"
>
<tspan x="160" y="600">{{ meta.siteName }} · {{ meta.url | replace("https://", "") | replace("http://", "") }}</tspan>
</text>
</svg>