diff --git a/packages/docusaurus-plugin-content-blog/src/__tests__/__fixtures__/website/blog/custom-rss.xslt b/packages/docusaurus-plugin-content-blog/src/__tests__/__fixtures__/website/blog/custom-rss.xslt index c258f34d5a42..4d793963cba1 100644 --- a/packages/docusaurus-plugin-content-blog/src/__tests__/__fixtures__/website/blog/custom-rss.xslt +++ b/packages/docusaurus-plugin-content-blog/src/__tests__/__fixtures__/website/blog/custom-rss.xslt @@ -7,16 +7,16 @@ - Atom Feed | <xsl:value-of select="atom:feed/atom:title" /> + RSS Feed | <xsl:value-of select="rss/channel/title" />
- This is an Atom feed. Subscribe by copying the URL from the address - bar into your newsreader. Visit About Feeds to learn more - and get started. It’s free.
+ This is an RSS feed. Subscribe by copying the URL from the address + bar into your newsreader. Visit About Feeds to learn more + and get started. It’s free.

- Custom Atom Feed Preview

+ Custom RSS Feed Preview

- +

-

Description:

+

Description:

Recent Posts

- +
- - + +
Published on + select="substring(pubDate,0,17)" />
- +
diff --git a/packages/docusaurus-plugin-content-blog/src/__tests__/__snapshots__/feed.test.ts.snap b/packages/docusaurus-plugin-content-blog/src/__tests__/__snapshots__/feed.test.ts.snap index de5e3b131595..7ad1a8155da7 100644 --- a/packages/docusaurus-plugin-content-blog/src/__tests__/__snapshots__/feed.test.ts.snap +++ b/packages/docusaurus-plugin-content-blog/src/__tests__/__snapshots__/feed.test.ts.snap @@ -629,7 +629,7 @@ exports[`atom has xslt files for feed 1`] = ` [ " + xmlns:atom="http://www.w3.org/2005/Atom"> @@ -644,27 +644,27 @@ exports[`atom has xslt files for feed 1`] = `
This is an Atom feed. Subscribe by copying the URL from the address - bar into your newsreader. Visit About Feeds to learn more - and get started. It’s free.
+ bar into your newsreader. Visit About Feeds to + learn more and get started. It’s free.

- - - - - - - - + xmlns:xlink="http://www.w3.org/1999/xlink" + viewBox="0 0 455.731 455.731" xml:space="preserve"> + + + + + + + +
- Custom Atom Feed Preview

+ Atom Feed Preview

@@ -962,149 +962,6 @@ exports[`json filters to the first two entries using limit 1`] = ` exports[`json has custom xslt files for feed 1`] = ` [ - " - - - - - - - - Atom Feed | <xsl:value-of select="atom:feed/atom:title" /> - - - -
-
-
- This is an Atom feed. Subscribe by copying the URL from the address - bar into your newsreader. Visit About Feeds to learn more - and get started. It’s free.
-

-
- - - - - - - - - - -
- Custom Atom Feed Preview

-

- -

-

Description:

-
-

Recent Posts

-
- -
- - - -
Published on -
-
- -
-
-
-
-
- - -
- -
-", - "/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -* { - color: #0d1137; -} - -main { - flex: 1 0 auto; - width: 100%; - margin: 4rem auto; - padding: 1.5 rem; - max-width: 800px; - /* stylelint-disable-next-line font-family-name-quotes */ - font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell; -} - -.info { - display: block; - margin: 3rem 0; - padding: 2rem 3rem; - border: 1px solid dodgerblue; - border-left-width: 0.5rem; - border-radius: 0.4rem; - background-color: #e52165; -} - -.rss-icon { - height: 3.8rem; - width: 3.8rem; - margin-right: 1rem; -} - -.flex { - display: flex; -} - -.items-start { - align-items: flex-start; -} - -.pb-7 { - padding-bottom: 3rem; -} - -a { - color: #005aff; - text-decoration: none; -} - -h1 { - text-wrap: balance; - font-size: 3.8rem; - line-height: 1; - font-weight: 800; - margin-bottom: 4rem; -} - -h2 { - font-size: 3rem; - line-height: 1.2; - font-weight: 700; - margin-bottom: 3rem; -} - -h2:not(:first-child) { - margin-top: 5.8rem; -} - -.italic { - font-style: italic; -} -", "{ "version": "https://jsonfeed.org/version/1", "title": "Hello Blog", @@ -1402,146 +1259,6 @@ exports[`json has feed item for each post 1`] = ` exports[`json has xslt files for feed 1`] = ` [ - " - - - - - - - - RSS Feed | <xsl:value-of select="rss/channel/title" /> - - - -
-
-
- This is an RSS feed. Subscribe by copying the URL from the address - bar into your newsreader. Visit About Feeds to learn more - and get started. It’s free.
-

-
- - - - - - - - - - -
- RSS Feed Preview

-

- -

-

Description:

-
-

Recent Posts

-
- -
- - - -
Published on -
-
- -
-
-
-
-
- - -
- -
-", - "/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -main { - flex: 1 0 auto; - width: 100%; - margin: 4rem auto; - padding: 1.5 rem; - max-width: 800px; - /* stylelint-disable-next-line font-family-name-quotes */ - font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell; -} - -.info { - display: block; - margin: 3rem 0; - padding: 2rem 3rem; - border: 1px solid dodgerblue; - border-left-width: 0.5rem; - border-radius: 0.4rem; - background-color: #edf5ff; -} - -.rss-icon { - height: 3.8rem; - width: 3.8rem; - margin-right: 1rem; -} - -.flex { - display: flex; -} - -.items-start { - align-items: flex-start; -} - -.pb-7 { - padding-bottom: 3rem; -} - -a { - color: #005aff; - text-decoration: none; -} - -h1 { - text-wrap: balance; - font-size: 3.8rem; - line-height: 1; - font-weight: 800; - margin-bottom: 4rem; -} - -h2 { - font-size: 3rem; - line-height: 1.2; - font-weight: 700; - margin-bottom: 3rem; -} - -h2:not(:first-child) { - margin-top: 5.8rem; -} - -.italic { - font-style: italic; -} -", "{ "version": "https://jsonfeed.org/version/1", "title": "Hello Blog", @@ -1746,16 +1463,16 @@ exports[`rss has custom xslt files for feed 1`] = ` - Atom Feed | <xsl:value-of select="atom:feed/atom:title" /> + RSS Feed | <xsl:value-of select="rss/channel/title" />
- This is an Atom feed. Subscribe by copying the URL from the address - bar into your newsreader. Visit About Feeds to learn more - and get started. It’s free.
+ This is an RSS feed. Subscribe by copying the URL from the address + bar into your newsreader. Visit About Feeds to learn more + and get started. It’s free.

- Custom Atom Feed Preview

+ Custom RSS Feed Preview

- +

-

Description:

+

Description:

Recent Posts

- +
- - + +
Published on + select="substring(pubDate,0,17)" />
- +
@@ -2248,11 +1966,11 @@ exports[`rss has xslt files for feed 1`] = ` [ " + xmlns:atom="http://www.w3.org/2005/Atom"> - + RSS Feed | <xsl:value-of select="rss/channel/title" /> @@ -2263,27 +1981,27 @@ exports[`rss has xslt files for feed 1`] = `
This is an RSS feed. Subscribe by copying the URL from the address - bar into your newsreader. Visit About Feeds to learn more - and get started. It’s free.
+ bar into your newsreader. Visit About Feeds to + learn more and get started. It’s free.

- - - - - - - - - + xmlns:xlink="http://www.w3.org/1999/xlink" + viewBox="0 0 455.731 455.731" xml:space="preserve"> + + + + + + + + +
- RSS Feed Preview

+ RSS Feed Preview

diff --git a/packages/docusaurus-plugin-content-blog/src/__tests__/feed.test.ts b/packages/docusaurus-plugin-content-blog/src/__tests__/feed.test.ts index 3c9c1332b6fd..c83122019ac0 100644 --- a/packages/docusaurus-plugin-content-blog/src/__tests__/feed.test.ts +++ b/packages/docusaurus-plugin-content-blog/src/__tests__/feed.test.ts @@ -94,6 +94,7 @@ describe.each(['atom', 'rss', 'json'])('%s', (feedType) => { feedOptions: { type: [feedType], copyright: 'Copyright', + xslt: {enabled: false}, }, readingTime: ({content, defaultReadingTime}) => defaultReadingTime({content}), @@ -137,6 +138,7 @@ describe.each(['atom', 'rss', 'json'])('%s', (feedType) => { feedOptions: { type: [feedType], copyright: 'Copyright', + xslt: {enabled: false}, }, readingTime: ({content, defaultReadingTime}) => defaultReadingTime({content}), @@ -192,6 +194,7 @@ describe.each(['atom', 'rss', 'json'])('%s', (feedType) => { ...rest, }); }, + xslt: {enabled: false}, }, readingTime: ({content, defaultReadingTime}) => defaultReadingTime({content}), @@ -238,6 +241,7 @@ describe.each(['atom', 'rss', 'json'])('%s', (feedType) => { type: [feedType], copyright: 'Copyright', limit: 2, + xslt: {enabled: false}, }, readingTime: ({content, defaultReadingTime}) => defaultReadingTime({content}), @@ -284,6 +288,7 @@ describe.each(['atom', 'rss', 'json'])('%s', (feedType) => { feedOptions: { type: [feedType], copyright: 'Copyright', + xslt: {enabled: false}, }, readingTime: ({content, defaultReadingTime}) => defaultReadingTime({content}), @@ -329,9 +334,7 @@ describe.each(['atom', 'rss', 'json'])('%s', (feedType) => { feedOptions: { type: [feedType], copyright: 'Copyright', - xslt: true, - rssXslt: 'rss.xslt', - atomXslt: 'atom.xslt', + xslt: {enabled: true, rssXslt: 'rss.xslt', atomXslt: 'atom.xslt'}, }, readingTime: ({content, defaultReadingTime}) => defaultReadingTime({content}), @@ -377,9 +380,11 @@ describe.each(['atom', 'rss', 'json'])('%s', (feedType) => { feedOptions: { type: [feedType], copyright: 'Copyright', - xslt: true, - rssXslt: 'custom-rss.xslt', - atomXslt: 'custom-atom.xslt', + xslt: { + enabled: true, + rssXslt: 'custom-rss.xslt', + atomXslt: 'custom-atom.xslt', + }, }, readingTime: ({content, defaultReadingTime}) => defaultReadingTime({content}), diff --git a/packages/docusaurus-plugin-content-blog/src/__tests__/options.test.ts b/packages/docusaurus-plugin-content-blog/src/__tests__/options.test.ts index 52f60e4e056a..63032123683c 100644 --- a/packages/docusaurus-plugin-content-blog/src/__tests__/options.test.ts +++ b/packages/docusaurus-plugin-content-blog/src/__tests__/options.test.ts @@ -41,9 +41,6 @@ describe('validateOptions', () => { feedOptions: { type: 'rss' as const, title: 'myTitle', - xslt: false, - atomXslt: 'atom.xslt', - rssXslt: 'rss.xslt', }, path: 'not_blog', routeBasePath: '/myBlog', @@ -59,9 +56,7 @@ describe('validateOptions', () => { title: 'myTitle', copyright: '', limit: 20, - xslt: false, - atomXslt: 'atom.xslt', - rssXslt: 'rss.xslt', + xslt: {enabled: false, atomXslt: 'atom.xslt', rssXslt: 'rss.xslt'}, }, }); }); @@ -115,9 +110,7 @@ describe('validateOptions', () => { type: ['rss', 'atom', 'json'], copyright: '', limit: 20, - xslt: false, - rssXslt: 'rss.xslt', - atomXslt: 'atom.xslt', + xslt: {enabled: false, atomXslt: 'atom.xslt', rssXslt: 'rss.xslt'}, }, }); }); @@ -132,9 +125,7 @@ describe('validateOptions', () => { feedOptions: { type: null, limit: 20, - xslt: false, - rssXslt: 'rss.xslt', - atomXslt: 'atom.xslt', + xslt: {enabled: false, atomXslt: 'atom.xslt', rssXslt: 'rss.xslt'}, }, }); }); @@ -159,9 +150,11 @@ describe('validateOptions', () => { title: 'title', copyright: '', limit: 20, - xslt: false, - rssXslt: 'rss.xslt', - atomXslt: 'atom.xslt', + xslt: { + enabled: false, + rssXslt: 'rss.xslt', + atomXslt: 'atom.xslt', + }, }, }); }); diff --git a/website/_dogfooding/_blog tests/custom-rss.xslt b/website/_dogfooding/_blog tests/custom-rss.xslt index 80406b153124..4d793963cba1 100644 --- a/website/_dogfooding/_blog tests/custom-rss.xslt +++ b/website/_dogfooding/_blog tests/custom-rss.xslt @@ -7,16 +7,16 @@ - Atom Feed | <xsl:value-of select="atom:feed/atom:title" /> - + RSS Feed | <xsl:value-of select="rss/channel/title" /> +
- This is an Atom feed. Subscribe by copying the URL from the address - bar into your newsreader. Visit About Feeds to learn more - and get started. It’s free.
+ This is an RSS feed. Subscribe by copying the URL from the address + bar into your newsreader. Visit About Feeds to learn more + and get started. It’s free.

- Custom Atom Feed Preview

+ Custom RSS Feed Preview

- +

-

Description:

+

Description:

Recent Posts

- +
- - + +
Published on + select="substring(pubDate,0,17)" />
- +