Implement weblog

Missing RSS, comments and tags.
This commit is contained in:
Sofía Aritz 2023-03-12 13:57:29 +01:00
parent 2b63e27bfa
commit ba9b759e53
7 changed files with 73 additions and 3 deletions

View file

@ -1,6 +1,25 @@
const { DateTime } = require("luxon")
const timeToRead = require("eleventy-plugin-time-to-read")
module.exports = function(eleventyConfig) { module.exports = function(eleventyConfig) {
eleventyConfig.addPassthroughCopy("css") eleventyConfig.addPassthroughCopy("css")
eleventyConfig.addPassthroughCopy({ "static": "/" }) eleventyConfig.addPassthroughCopy({ "static": "/" })
eleventyConfig.addPlugin(timeToRead, {
language: "es",
style: "long",
hours: "auto",
minutes: true,
})
eleventyConfig.addFilter("readableDate", dateObj => {
return DateTime.fromJSDate(dateObj, {zone: 'utc'}).setLocale("es-ES").toFormat("dd LLL yyyy");
})
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string
eleventyConfig.addFilter('htmlDateString', dateObj => {
return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat('yyyy-LL-dd');
})
return { return {
passthroughFileCopy: true passthroughFileCopy: true
} }

18
_includes/post.njk Normal file
View file

@ -0,0 +1,18 @@
---
layout: simple_page.njk
---
<h1>{{ title }}</h1>
{% if date %}
<time datetime="{{ date | htmlDateString }}">{{ date | readableDate }}</time> |
{% endif %}
{% if tags %}
{% for tag in tags %}
<span>{{ tag }} {% if loop.last == false %}·{% endif %}</span>
{% endfor %}
|
{% endif %}
{{ content | timeToRead }}
{{ content | safe }}

View file

@ -26,7 +26,7 @@
<div> <div>
<i>mi cabeza</i> <i>mi cabeza</i>
<ul> <ul>
<!-- <li><a href="/weblog">weblog</a></li> --> <li><a href="/weblog">weblog</a></li>
<li><a href="/recommendations">recomendaciones</a></li> <li><a href="/recommendations">recomendaciones</a></li>
</ul> </ul>
</div> </div>

View file

@ -13,6 +13,8 @@
"deploy": "cd _scripts && ./deploy.sh" "deploy": "cd _scripts && ./deploy.sh"
}, },
"devDependencies": { "devDependencies": {
"@11ty/eleventy": "^2.0.0" "@11ty/eleventy": "^2.0.0",
"eleventy-plugin-time-to-read": "^1.3.0",
"luxon": "^3.3.0"
} }
} }

11
weblog.md Normal file
View file

@ -0,0 +1,11 @@
---
layout: simple_page.njk
tags: meta
title: weblog
---
# weblog
Aquí iré hablando sobre ideas, experiencias y demás cosas que podrían ser relevantes!
### 2023
1. [Primer post](/weblog/firstpost) El nacimiento de mi weblog! :)

15
weblog/firstpost.md Normal file
View file

@ -0,0 +1,15 @@
---
layout: post.njk
title: Primer post
tags:
- meta
date: 2023-03-12
---
Este es el primer post del weblog! Aquí iré compartiendo ideas, ocurrencias y experiencias a medida que me mueva por
los mundos de Internet y la programación.
Ahora mismo este weblog está parcialmente incompleto, pero dentro de poco añadiré las cosas que faltan para que esté
completamente a punto ([RSS](https://es.wikipedia.org/wiki/RSS), etiquetas, comentarios, etc).
Cualquier sugerencia o idea para este weblog podéis [enviármela](/contact) sin problema!

View file

@ -456,6 +456,11 @@ ejs@^3.1.8:
dependencies: dependencies:
jake "^10.8.5" jake "^10.8.5"
eleventy-plugin-time-to-read@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/eleventy-plugin-time-to-read/-/eleventy-plugin-time-to-read-1.3.0.tgz#17701132491b522fa013fcc103a24eafe3b56082"
integrity sha512-EefxYZJviQbClwoQ+pXW0YsVoi3gzXJ3prJoOLO1g3n5dM17KyZh81/yyq5Inrdc2pxBz3CXsyo21kk43gK/Gg==
encodeurl@~1.0.2: encodeurl@~1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
@ -859,7 +864,7 @@ lru-cache@^6.0.0:
dependencies: dependencies:
yallist "^4.0.0" yallist "^4.0.0"
luxon@^3.2.1: luxon@^3.2.1, luxon@^3.3.0:
version "3.3.0" version "3.3.0"
resolved "https://registry.yarnpkg.com/luxon/-/luxon-3.3.0.tgz#d73ab5b5d2b49a461c47cedbc7e73309b4805b48" resolved "https://registry.yarnpkg.com/luxon/-/luxon-3.3.0.tgz#d73ab5b5d2b49a461c47cedbc7e73309b4805b48"
integrity sha512-An0UCfG/rSiqtAIiBPO0Y9/zAnHUZxAMiCpTd5h2smgsj7GGmcenvrvww2cqNA8/4A5ZrD1gJpHN2mIHZQF+Mg== integrity sha512-An0UCfG/rSiqtAIiBPO0Y9/zAnHUZxAMiCpTd5h2smgsj7GGmcenvrvww2cqNA8/4A5ZrD1gJpHN2mIHZQF+Mg==