qBittorrent-website/.eleventy.js
Chocobo1 0f38d24ae8
Restructure news page generation
* Now `news.md` uses the `base.liquid` template directly and appends `old_news.md` at the
bottom of the page.
* `old_news` is converted to markdown format with minimal modification. This is to let
`markdown-it-anchor` plugin generate anchors.
2023-11-01 06:27:23 +08:00

23 lines
722 B
JavaScript

const MarkdownItAnchor = require("markdown-it-anchor");
module.exports = (eleventyConfig) => {
// Copy files as-is
eleventyConfig.addPassthroughCopy("img");
eleventyConfig.addPassthroughCopy("css");
eleventyConfig.addPassthroughCopy(".htaccess");
eleventyConfig.addPassthroughCopy("favicon.ico");
eleventyConfig.addPassthroughCopy("favicon.svg");
// Ignored files
eleventyConfig.ignores.add("old_news.md");
eleventyConfig.ignores.add("README.md");
eleventyConfig.amendLibrary("md", (mdLib) => {
// https://github.com/valeriangalliat/markdown-it-anchor#usage
const options = {
permalink: MarkdownItAnchor.permalink.headerLink()
};
mdLib.use(MarkdownItAnchor, options);
});
};