Skip to content

Commit

Permalink
Add slugify’d blog title to input path to better fix inputPath confli…
Browse files Browse the repository at this point in the history
…cts.
  • Loading branch information
zachleat committed Jun 10, 2024
1 parent 7a517b4 commit f80a1bd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/virtualTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ async function eleventyFeedPlugin(eleventyConfig, options = {}) {
eleventyConfig.addPlugin(pluginRss, options.rssPluginOptions || {});

// Guaranteed unique
let pluginHtmlBase = await eleventyConfig.resolvePlugin("@11ty/eleventy/html-base-plugin");
const pluginHtmlBase = await eleventyConfig.resolvePlugin("@11ty/eleventy/html-base-plugin");
eleventyConfig.addPlugin(pluginHtmlBase, options.htmlBasePluginOptions || {});

let slugifyFilter = eleventyConfig.getFilter("slugify");
let inputPathSuffix = options?.metadata?.title ? `-${slugifyFilter(options?.metadata?.title)}` : "";
options = DeepCopy({
// rss and json also supported
type: "atom",
Expand All @@ -109,7 +111,7 @@ async function eleventyFeedPlugin(eleventyConfig, options = {}) {
limit: 0, // limit number of entries, 0 means no limit
},
outputPath: "/feed.xml",
inputPath: `virtual:eleventy-plugin-feed-${options.type || "atom"}.njk`, // TODO make this more unique
inputPath: `eleventy-plugin-feed${inputPathSuffix}-${options.type || "atom"}.njk`, // TODO make this more unique
templateData: {},
metadata: {
title: "Blog Title",
Expand Down

0 comments on commit f80a1bd

Please sign in to comment.