From 96664355a8af1f131f9806c9375927abcd5bec36 Mon Sep 17 00:00:00 2001 From: Tiago Celestino <190265+tcelestino@users.noreply.github.com> Date: Wed, 30 Oct 2024 18:00:57 -0300 Subject: [PATCH] feat: 11yt settings (#53) --- .eleventy.js | 10 +++++++++- 404.html | 1 + index.njk => index.html | 6 +++--- package.json | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) rename index.njk => index.html (82%) diff --git a/.eleventy.js b/.eleventy.js index 7927572..f74df0b 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -2,6 +2,12 @@ const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight'); module.exports = (eleventyConfig) => { eleventyConfig.addPassthroughCopy('assets'); + + eleventyConfig.addCollection('post', (collection) => { + // reversed all collections posts + return collection.getFilteredByGlob('posts/**/*.md').reverse(); + }); + eleventyConfig.addFilter('readableDate', (dateObj) => { const date = new Date(dateObj); date.setMinutes(date.getMinutes() + date.getTimezoneOffset()); @@ -11,13 +17,15 @@ module.exports = (eleventyConfig) => { year: 'numeric', }); }); + eleventyConfig.addPlugin(syntaxHighlight); + return { dir: { input: './', output: './_site', layouts: './_layouts', }, - templateFormats: ['html', 'liquid', 'md', 'njk'], + templateFormats: ['html', 'md'], }; }; diff --git a/404.html b/404.html index 3b4315e..419c102 100644 --- a/404.html +++ b/404.html @@ -1,4 +1,5 @@ --- +eleventyExcludeFromCollections: true title: Not Found permalink: 404.html layout: default diff --git a/index.njk b/index.html similarity index 82% rename from index.njk rename to index.html index 62516a2..62fdbe2 100644 --- a/index.njk +++ b/index.html @@ -1,16 +1,16 @@ --- layout: default --- -
Anotações para mim mesmo, mas se tiver interesse em ler, fique a vontade.
    - {%- for post in collections.post | reverse -%} + {%- for post in collections.post -%}
  1. - {{ post.data.title | safe }} + {{ post.data.title | raw }}

  2. {%- endfor -%}
+
diff --git a/package.json b/package.json index ff71478..a4a4006 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "scripts": { "clean": "rm -rf ./_site", "build": "npm run clean && eleventy --pathprefix=bloco-de-notas", - "dev": "DEBUG=Eleventy* eleventy --serve --watch", + "dev": "yarn clean && DEBUG=Eleventy* eleventy --serve --watch", "start": "eleventy --serve --watch" }, "repository": {