Fix: sitemap adds css/js files
This commit is contained in:
parent
379c7936ed
commit
ab9df8fa77
3 changed files with 12 additions and 4 deletions
|
|
@ -40,6 +40,7 @@ const {
|
||||||
|
|
||||||
// module import collections
|
// module import collections
|
||||||
const {getAllPosts} = require('./config/collections/index.js');
|
const {getAllPosts} = require('./config/collections/index.js');
|
||||||
|
const {onlyMarkdown} = require('./config/collections/index.js');
|
||||||
|
|
||||||
// module import events
|
// module import events
|
||||||
const {svgToJpeg} = require('./config/events/index.js');
|
const {svgToJpeg} = require('./config/events/index.js');
|
||||||
|
|
@ -102,6 +103,7 @@ module.exports = eleventyConfig => {
|
||||||
|
|
||||||
// --------------------- Custom collections -----------------------
|
// --------------------- Custom collections -----------------------
|
||||||
eleventyConfig.addCollection('posts', getAllPosts);
|
eleventyConfig.addCollection('posts', getAllPosts);
|
||||||
|
eleventyConfig.addCollection('onlyMarkdown', onlyMarkdown);
|
||||||
|
|
||||||
// --------------------- Events ---------------------
|
// --------------------- Events ---------------------
|
||||||
eleventyConfig.on('afterBuild', svgToJpeg);
|
eleventyConfig.on('afterBuild', svgToJpeg);
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,15 @@
|
||||||
/** Returns all blog posts as a collection. */
|
/** All blog posts as a collection. */
|
||||||
const getAllPosts = collection => {
|
const getAllPosts = collection => {
|
||||||
const projects = collection.getFilteredByGlob('./src/posts/*.md');
|
const projects = collection.getFilteredByGlob('./src/posts/*.md');
|
||||||
return projects.reverse();
|
return projects.reverse();
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
/** All markdown files as a collection for sitemap.xml */
|
||||||
getAllPosts
|
const onlyMarkdown = collection => {
|
||||||
|
return collection.getFilteredByGlob('./src/**/*.md');
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
getAllPosts,
|
||||||
|
onlyMarkdown
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ excludeFromSitemap: true
|
||||||
---
|
---
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||||
{% for page in collections.all %}
|
{% for page in collections.onlyMarkdown %}
|
||||||
{% if page.url and page.data.excludeFromSitemap != true %}
|
{% if page.url and page.data.excludeFromSitemap != true %}
|
||||||
|
|
||||||
{% if page.data.lastUpdated %}{% set lastmod = page.data.lastUpdated %}
|
{% if page.data.lastUpdated %}{% set lastmod = page.data.lastUpdated %}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue