добавил генерацию /notes/

This commit is contained in:
Maxim Slipenko 2022-05-15 12:27:00 +03:00
parent ee9527214f
commit 51adcae75d
Signed by: Maks1mS
GPG Key ID: 7461AF39A8705FB8
6 changed files with 24 additions and 4 deletions

View File

@ -4,6 +4,8 @@ const svgContents = require('eleventy-plugin-svg-contents')
const faviconPlugin = require('eleventy-favicon') const faviconPlugin = require('eleventy-favicon')
module.exports = (eleventyConfig) => { module.exports = (eleventyConfig) => {
eleventyConfig.setUseGitIgnore(false)
eleventyConfig.addPlugin(cagovBuildSystem, { eleventyConfig.addPlugin(cagovBuildSystem, {
processors: { processors: {
rollup: { rollup: {
@ -27,6 +29,10 @@ module.exports = (eleventyConfig) => {
destination: './dist' destination: './dist'
}) })
eleventyConfig.addCollection('notes', function (collectionApi) {
return collectionApi.getFilteredByGlob('src/notes/**/*.md')
})
return { return {
dir: { dir: {
input: 'src', input: 'src',

1
src/data/permalink.js Normal file
View File

@ -0,0 +1 @@
module.exports = false

View File

@ -0,0 +1,5 @@
module.exports = {
layout: 'base.njk',
permalink: '/index.html'
}

View File

@ -1,7 +1,3 @@
---
permalink: '/'
layout: 'base.njk'
---
<header class="flex justify-center w-full px-10 py-4"> <header class="flex justify-center w-full px-10 py-4">
<a href="/" class="block rounded-xl p-1"> <a href="/" class="block rounded-xl p-1">
{{ '/src/images/logo.svg' | svgContents("max-h-24 block w-[50vw]") | safe }} {{ '/src/images/logo.svg' | svgContents("max-h-24 block w-[50vw]") | safe }}

View File

@ -0,0 +1,11 @@
module.exports = {
layout: 'base.njk',
pagination: {
data: 'collections.notes',
size: 1,
alias: 'note'
},
permalink: '/{{note.filePathStem}}.html'
}

1
src/pages/note.njk Normal file
View File

@ -0,0 +1 @@
{{ note.templateContent | safe }}