@11ty/eleventy-plugin-rss
Advanced tools
Comparing version 2.0.0-beta.4 to 2.0.0-beta.5
{ | ||
"name": "@11ty/eleventy-plugin-rss", | ||
"version": "2.0.0-beta.4", | ||
"version": "2.0.0-beta.5", | ||
"description": "A pack of Eleventy plugins for generating an RSS feed using the Nunjucks templating engine.", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
@@ -6,2 +6,3 @@ const pkg = require("../package.json"); | ||
function getFeedContent(type, { stylesheet, collectionName, limit }) { | ||
let stylesheetUrl = stylesheet?.[type]; | ||
// Note: page.lang comes from the i18n plugin: https://www.11ty.dev/docs/plugins/i18n/#page.lang | ||
@@ -12,3 +13,3 @@ | ||
return `<?xml version="1.0" encoding="utf-8"?> | ||
${stylesheet ? `<?xml-stylesheet href="${stylesheet}" type="text/xsl"?>\n` : ""}<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:base="{{ metadata.base | addPathPrefixToFullUrl }}" xmlns:atom="http://www.w3.org/2005/Atom"> | ||
${stylesheetUrl ? `<?xml-stylesheet href="${stylesheetUrl}" type="text/xsl"?>\n` : ""}<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:base="{{ metadata.base | addPathPrefixToFullUrl }}" xmlns:atom="http://www.w3.org/2005/Atom"> | ||
<channel> | ||
@@ -38,3 +39,3 @@ <title>{{ metadata.title }}</title> | ||
return `<?xml version="1.0" encoding="utf-8"?> | ||
${stylesheet ? `<?xml-stylesheet href="${stylesheet}" type="text/xsl"?>\n` : ""}<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ metadata.language or page.lang }}"> | ||
${stylesheetUrl ? `<?xml-stylesheet href="${stylesheetUrl}" type="text/xsl"?>\n` : ""}<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ metadata.language or page.lang }}"> | ||
<title>{{ metadata.title }}</title> | ||
@@ -113,6 +114,10 @@ <subtitle>{{ metadata.subtitle }}</subtitle> | ||
collectionName: false, // required | ||
limit: 0, // limit number of entries, 0 means no limit | ||
files: { | ||
"atom": "/feed.xml" | ||
// rss and json also supported | ||
atom: "/feed.xml", | ||
}, | ||
limit: 0, // limit number of entries, 0 means no limit | ||
templateData: { | ||
// atom: {}, | ||
}, | ||
metadata: { | ||
@@ -135,3 +140,3 @@ title: "Blog Title", | ||
let templateData = { | ||
eleventyExcludeFromCollections: true, | ||
eleventyExcludeFromCollections: [ options.collectionName ], | ||
eleventyImport: { | ||
@@ -151,3 +156,3 @@ collections: [ options.collectionName ], | ||
return array.slice(0, n); | ||
} | ||
}, | ||
}; | ||
@@ -160,3 +165,3 @@ | ||
if(Array.isArray(files) && files.length === 2) { | ||
if(Array.isArray(files) && files.length >= 2) { | ||
[inputPath, outputPath] = files; | ||
@@ -172,2 +177,3 @@ } else if(typeof files === "string") { | ||
permalink: outputPath, | ||
...options?.templateData?.[type] || {}, | ||
...templateData, | ||
@@ -174,0 +180,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15506
289