From 3b0202479a81ad97db7c3d9347b6ba8ab900821f Mon Sep 17 00:00:00 2001 From: xebec19 Date: Sun, 3 Sep 2023 13:39:15 +0530 Subject: [PATCH] feat(rss feed): made xslt feed modular and added custom feeds --- .cspell.json | 1 + .../assets/atom-feed.stylesheet.css | 72 + .../assets/atom-feed.xslt | 65 + .../assets/rss-feed.stylesheet.css | 72 + .../assets/rss-feed.xslt | 66 + .../build-snap/blog/rss-feed.stylesheet.css | 68 + .../__tests__/__snapshots__/feed.test.ts.snap | 1686 ++++++++++++++--- .../src/__tests__/feed.test.ts | 92 + .../src/feed.ts | 129 +- .../src/options.ts | 5 + .../src/plugin-content-blog.d.ts | 9 + website/_dogfooding/dogfooding.config.js | 5 + website/docusaurus.config.js | 3 + website/static/custom-atom.stylesheet.xslt | 65 + website/static/custom-rss.stylesheet.xslt | 66 + website/static/rss.xslt | 33 - website/static/styles.css | 35 - website/static/xslt-stylesheet.css | 76 + 18 files changed, 2250 insertions(+), 298 deletions(-) create mode 100644 packages/docusaurus-plugin-content-blog/assets/atom-feed.stylesheet.css create mode 100644 packages/docusaurus-plugin-content-blog/assets/atom-feed.xslt create mode 100644 packages/docusaurus-plugin-content-blog/assets/rss-feed.stylesheet.css create mode 100644 packages/docusaurus-plugin-content-blog/assets/rss-feed.xslt create mode 100644 packages/docusaurus-plugin-content-blog/src/__tests__/__fixtures__/website/build-snap/blog/rss-feed.stylesheet.css create mode 100644 website/static/custom-atom.stylesheet.xslt create mode 100644 website/static/custom-rss.stylesheet.xslt delete mode 100644 website/static/rss.xslt delete mode 100644 website/static/styles.css create mode 100644 website/static/xslt-stylesheet.css diff --git a/.cspell.json b/.cspell.json index 792ec239195d..b5579c09ab93 100644 --- a/.cspell.json +++ b/.cspell.json @@ -31,6 +31,7 @@ "website/docusaurus.config.localized.json", "*.xyz", "*.docx", + "*.xslt", "*.gitignore", "versioned_docs", "*.min.*", diff --git a/packages/docusaurus-plugin-content-blog/assets/atom-feed.stylesheet.css b/packages/docusaurus-plugin-content-blog/assets/atom-feed.stylesheet.css new file mode 100644 index 000000000000..17d483670f0d --- /dev/null +++ b/packages/docusaurus-plugin-content-blog/assets/atom-feed.stylesheet.css @@ -0,0 +1,72 @@ +/** + * 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; +} diff --git a/packages/docusaurus-plugin-content-blog/assets/atom-feed.xslt b/packages/docusaurus-plugin-content-blog/assets/atom-feed.xslt new file mode 100644 index 000000000000..d619961df098 --- /dev/null +++ b/packages/docusaurus-plugin-content-blog/assets/atom-feed.xslt @@ -0,0 +1,65 @@ + + + + + + + + + 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.
+

+
+ + + + + + + + + + +
+ Atom Feed Preview

+

+ +

+

Description:

+
+

Recent Posts

+
+ +
+ + + +
Published on +
+
+ +
+
+
+
+
+ + +
+ +
\ No newline at end of file diff --git a/packages/docusaurus-plugin-content-blog/assets/rss-feed.stylesheet.css b/packages/docusaurus-plugin-content-blog/assets/rss-feed.stylesheet.css new file mode 100644 index 000000000000..17d483670f0d --- /dev/null +++ b/packages/docusaurus-plugin-content-blog/assets/rss-feed.stylesheet.css @@ -0,0 +1,72 @@ +/** + * 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; +} diff --git a/packages/docusaurus-plugin-content-blog/assets/rss-feed.xslt b/packages/docusaurus-plugin-content-blog/assets/rss-feed.xslt new file mode 100644 index 000000000000..c8a4c85780f1 --- /dev/null +++ b/packages/docusaurus-plugin-content-blog/assets/rss-feed.xslt @@ -0,0 +1,66 @@ + + + + + + + + + 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 +
+
+ +
+
+
+
+
+ + +
+ +
\ No newline at end of file diff --git a/packages/docusaurus-plugin-content-blog/src/__tests__/__fixtures__/website/build-snap/blog/rss-feed.stylesheet.css b/packages/docusaurus-plugin-content-blog/src/__tests__/__fixtures__/website/build-snap/blog/rss-feed.stylesheet.css new file mode 100644 index 000000000000..2be936239e3b --- /dev/null +++ b/packages/docusaurus-plugin-content-blog/src/__tests__/__fixtures__/website/build-snap/blog/rss-feed.stylesheet.css @@ -0,0 +1,68 @@ +/** + * 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; +} 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 faa3d6444520..23679d1dd731 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 @@ -2,7 +2,7 @@ exports[`atom filters to the first two entries 1`] = ` [ - " + " https://docusaurus.io/myBaseUrl/blog Hello Blog @@ -48,7 +48,7 @@ exports[`atom filters to the first two entries 1`] = ` exports[`atom filters to the first two entries using limit 1`] = ` [ - " + " https://docusaurus.io/myBaseUrl/blog Hello Blog @@ -92,9 +92,147 @@ exports[`atom filters to the first two entries using limit 1`] = ` ] `; -exports[`atom has feed item for each post 1`] = ` +exports[`atom 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.
+

+
+ + + + + + + + + + +
+ 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. + */ + +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; +} +", + " https://docusaurus.io/myBaseUrl/blog Hello Blog @@ -220,184 +358,25 @@ exports[`atom has feed item for each post 1`] = ` ] `; -exports[`json filters to the first two entries 1`] = ` -[ - "{ - "version": "https://jsonfeed.org/version/1", - "title": "Hello Blog", - "home_page_url": "https://docusaurus.io/myBaseUrl/blog", - "description": "Hello Blog", - "items": [ - { - "id": "https://docusaurus.io/myBaseUrl/blog/blog-with-links", - "content_html": "

absolute full url

/n

absolute pathname

/n

relative pathname

/n

md link

/n

anchor

/n

relative pathname + anchor

/n

/n

\\"\\"

/n/n", - "url": "https://docusaurus.io/myBaseUrl/blog/blog-with-links", - "title": "test links", - "summary": "absolute full url", - "date_modified": "2023-07-23T00:00:00.000Z", - "tags": [] - }, - { - "id": "https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post", - "content_html": "

Test MDX with require calls

/n/n/n/n/n", - "url": "https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post", - "title": "MDX Blog Sample with require calls", - "summary": "Test MDX with require calls", - "date_modified": "2021-03-06T00:00:00.000Z", - "tags": [] - } - ] -}", -] -`; - -exports[`json filters to the first two entries using limit 1`] = ` -[ - "{ - "version": "https://jsonfeed.org/version/1", - "title": "Hello Blog", - "home_page_url": "https://docusaurus.io/myBaseUrl/blog", - "description": "Hello Blog", - "items": [ - { - "id": "https://docusaurus.io/myBaseUrl/blog/blog-with-links", - "content_html": "

absolute full url

/n

absolute pathname

/n

relative pathname

/n

md link

/n

anchor

/n

relative pathname + anchor

/n

/n

\\"\\"

/n/n", - "url": "https://docusaurus.io/myBaseUrl/blog/blog-with-links", - "title": "test links", - "summary": "absolute full url", - "date_modified": "2023-07-23T00:00:00.000Z", - "tags": [] - }, - { - "id": "https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post", - "content_html": "

Test MDX with require calls

/n/n/n/n/n", - "url": "https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post", - "title": "MDX Blog Sample with require calls", - "summary": "Test MDX with require calls", - "date_modified": "2021-03-06T00:00:00.000Z", - "tags": [] - } - ] -}", -] -`; - -exports[`json has feed item for each post 1`] = ` -[ - "{ - "version": "https://jsonfeed.org/version/1", - "title": "Hello Blog", - "home_page_url": "https://docusaurus.io/myBaseUrl/blog", - "description": "Hello Blog", - "items": [ - { - "id": "https://docusaurus.io/myBaseUrl/blog/blog-with-links", - "content_html": "

absolute full url

/n

absolute pathname

/n

relative pathname

/n

md link

/n

anchor

/n

relative pathname + anchor

/n

/n

\\"\\"

/n/n", - "url": "https://docusaurus.io/myBaseUrl/blog/blog-with-links", - "title": "test links", - "summary": "absolute full url", - "date_modified": "2023-07-23T00:00:00.000Z", - "tags": [] - }, - { - "id": "https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post", - "content_html": "

Test MDX with require calls

/n/n/n/n/n", - "url": "https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post", - "title": "MDX Blog Sample with require calls", - "summary": "Test MDX with require calls", - "date_modified": "2021-03-06T00:00:00.000Z", - "tags": [] - }, - { - "id": "https://docusaurus.io/myBaseUrl/blog/mdx-blog-post", - "content_html": "

HTML Heading 1

/n

HTML Heading 2

/n

HTML Paragraph

/n/n/n

Import DOM

/n

Heading 1

/n

Heading 2

/n

Heading 3

/n

Heading 4

/n
Heading 5
/n
    /n
  • list1
  • /n
  • list2
  • /n
  • list3
  • /n
/n
    /n
  • list1
  • /n
  • list2
  • /n
  • list3
  • /n
/n

Normal Text Italics Text Bold Text

/n

link \\"image\\"

", - "url": "https://docusaurus.io/myBaseUrl/blog/mdx-blog-post", - "title": "Full Blog Sample", - "summary": "HTML Heading 1", - "date_modified": "2021-03-05T00:00:00.000Z", - "tags": [] - }, - { - "id": "https://docusaurus.io/myBaseUrl/blog/hey/my super path/héllô", - "content_html": "

complex url slug

", - "url": "https://docusaurus.io/myBaseUrl/blog/hey/my super path/héllô", - "title": "Complex Slug", - "summary": "complex url slug", - "date_modified": "2020-08-16T00:00:00.000Z", - "tags": [ - "date", - "complex" - ] - }, - { - "id": "https://docusaurus.io/myBaseUrl/blog/simple/slug", - "content_html": "

simple url slug

", - "url": "https://docusaurus.io/myBaseUrl/blog/simple/slug", - "title": "Simple Slug", - "summary": "simple url slug", - "date_modified": "2020-08-15T00:00:00.000Z", - "author": { - "name": "Sébastien Lorber", - "url": "https://sebastienlorber.com" - }, - "tags": [] - }, - { - "id": "https://docusaurus.io/myBaseUrl/blog/heading-as-title", - "content_html": "", - "url": "https://docusaurus.io/myBaseUrl/blog/heading-as-title", - "title": "some heading", - "date_modified": "2019-01-02T00:00:00.000Z", - "tags": [] - }, - { - "id": "https://docusaurus.io/myBaseUrl/blog/date-matter", - "content_html": "

date inside front matter

", - "url": "https://docusaurus.io/myBaseUrl/blog/date-matter", - "title": "date-matter", - "summary": "date inside front matter", - "date_modified": "2019-01-01T00:00:00.000Z", - "tags": [ - "date" - ] - }, - { - "id": "https://docusaurus.io/myBaseUrl/blog/2018/12/14/Happy-First-Birthday-Slash", - "content_html": "

Happy birthday! (translated)

", - "url": "https://docusaurus.io/myBaseUrl/blog/2018/12/14/Happy-First-Birthday-Slash", - "title": "Happy 1st Birthday Slash! (translated)", - "summary": "Happy birthday! (translated)", - "date_modified": "2018-12-14T00:00:00.000Z", - "author": { - "name": "Yangshun Tay (translated)" - }, - "tags": [] - } - ] -}", -] -`; - -exports[`rss filters to the first two entries 1`] = ` +exports[`atom has feed item for each post 1`] = ` [ - " - - - Hello Blog - https://docusaurus.io/myBaseUrl/blog - Hello Blog - Sun, 23 Jul 2023 00:00:00 GMT - https://validator.w3.org/feed/docs/rss2.html - https://github.com/jpmonette/feed - en - Copyright - - <![CDATA[test links]]> - https://docusaurus.io/myBaseUrl/blog/blog-with-links - https://docusaurus.io/myBaseUrl/blog/blog-with-links - Sun, 23 Jul 2023 00:00:00 GMT - - absolute full url

+ " + + https://docusaurus.io/myBaseUrl/blog + Hello Blog + 2023-07-23T00:00:00.000Z + https://github.com/jpmonette/feed + + Hello Blog + https://docusaurus.io/myBaseUrl/image/favicon.ico + Copyright + + <![CDATA[test links]]> + https://docusaurus.io/myBaseUrl/blog/blog-with-links + + 2023-07-23T00:00:00.000Z + + absolute full url

absolute pathname

relative pathname

md link

@@ -406,50 +385,983 @@ exports[`rss filters to the first two entries 1`] = `

-]]>
-
- - <![CDATA[MDX Blog Sample with require calls]]> - https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post - https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post - Sat, 06 Mar 2021 00:00:00 GMT - - Test MDX with require calls

+]]> + + + <![CDATA[MDX Blog Sample with require calls]]> + https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post + + 2021-03-06T00:00:00.000Z + + Test MDX with require calls

-]]>
-
-
-
", -] -`; - -exports[`rss filters to the first two entries using limit 1`] = ` -[ - " - - - Hello Blog - https://docusaurus.io/myBaseUrl/blog - Hello Blog - Sun, 23 Jul 2023 00:00:00 GMT - https://validator.w3.org/feed/docs/rss2.html - https://github.com/jpmonette/feed - en - Copyright - - <![CDATA[test links]]> - https://docusaurus.io/myBaseUrl/blog/blog-with-links - https://docusaurus.io/myBaseUrl/blog/blog-with-links - Sun, 23 Jul 2023 00:00:00 GMT - - absolute full url

-

absolute pathname

-

relative pathname

-

md link

-

anchor

+]]> + + + <![CDATA[Full Blog Sample]]> + https://docusaurus.io/myBaseUrl/blog/mdx-blog-post + + 2021-03-05T00:00:00.000Z + + HTML Heading 1 +

HTML Heading 2

+

HTML Paragraph

+ + +

Import DOM

+

Heading 1

+

Heading 2

+

Heading 3

+

Heading 4

+
Heading 5
+
    +
  • list1
  • +
  • list2
  • +
  • list3
  • +
+
    +
  • list1
  • +
  • list2
  • +
  • list3
  • +
+

Normal Text Italics Text Bold Text

+

link image

]]>
+
+ + <![CDATA[Complex Slug]]> + https://docusaurus.io/myBaseUrl/blog/hey/my super path/héllô + + 2020-08-16T00:00:00.000Z + + complex url slug

]]>
+ + +
+ + <![CDATA[Simple Slug]]> + https://docusaurus.io/myBaseUrl/blog/simple/slug + + 2020-08-15T00:00:00.000Z + + simple url slug

]]>
+ + Sébastien Lorber + https://sebastienlorber.com + +
+ + <![CDATA[some heading]]> + https://docusaurus.io/myBaseUrl/blog/heading-as-title + + 2019-01-02T00:00:00.000Z + + + <![CDATA[date-matter]]> + https://docusaurus.io/myBaseUrl/blog/date-matter + + 2019-01-01T00:00:00.000Z + + date inside front matter

]]>
+ +
+ + <![CDATA[Happy 1st Birthday Slash! (translated)]]> + https://docusaurus.io/myBaseUrl/blog/2018/12/14/Happy-First-Birthday-Slash + + 2018-12-14T00:00:00.000Z + + Happy birthday! (translated)

]]>
+ + Yangshun Tay (translated) + + + Sébastien Lorber (translated) + lorber.sebastien@gmail.com + +
+
", +] +`; + +exports[`atom has xslt files for feed 1`] = ` +[ + " + + https://docusaurus.io/myBaseUrl/blog + Hello Blog + 2023-07-23T00:00:00.000Z + https://github.com/jpmonette/feed + + Hello Blog + https://docusaurus.io/myBaseUrl/image/favicon.ico + Copyright + + <![CDATA[test links]]> + https://docusaurus.io/myBaseUrl/blog/blog-with-links + + 2023-07-23T00:00:00.000Z + + absolute full url

+

absolute pathname

+

relative pathname

+

md link

+

anchor

+

relative pathname + anchor

+

+

+ +]]>
+
+ + <![CDATA[MDX Blog Sample with require calls]]> + https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post + + 2021-03-06T00:00:00.000Z + + Test MDX with require calls

+ + + + +]]>
+
+ + <![CDATA[Full Blog Sample]]> + https://docusaurus.io/myBaseUrl/blog/mdx-blog-post + + 2021-03-05T00:00:00.000Z + + HTML Heading 1 +

HTML Heading 2

+

HTML Paragraph

+ + +

Import DOM

+

Heading 1

+

Heading 2

+

Heading 3

+

Heading 4

+
Heading 5
+
    +
  • list1
  • +
  • list2
  • +
  • list3
  • +
+
    +
  • list1
  • +
  • list2
  • +
  • list3
  • +
+

Normal Text Italics Text Bold Text

+

link image

]]>
+
+ + <![CDATA[Complex Slug]]> + https://docusaurus.io/myBaseUrl/blog/hey/my super path/héllô + + 2020-08-16T00:00:00.000Z + + complex url slug

]]>
+ + +
+ + <![CDATA[Simple Slug]]> + https://docusaurus.io/myBaseUrl/blog/simple/slug + + 2020-08-15T00:00:00.000Z + + simple url slug

]]>
+ + Sébastien Lorber + https://sebastienlorber.com + +
+ + <![CDATA[some heading]]> + https://docusaurus.io/myBaseUrl/blog/heading-as-title + + 2019-01-02T00:00:00.000Z + + + <![CDATA[date-matter]]> + https://docusaurus.io/myBaseUrl/blog/date-matter + + 2019-01-01T00:00:00.000Z + + date inside front matter

]]>
+ +
+ + <![CDATA[Happy 1st Birthday Slash! (translated)]]> + https://docusaurus.io/myBaseUrl/blog/2018/12/14/Happy-First-Birthday-Slash + + 2018-12-14T00:00:00.000Z + + Happy birthday! (translated)

]]>
+ + Yangshun Tay (translated) + + + Sébastien Lorber (translated) + lorber.sebastien@gmail.com + +
+
", +] +`; + +exports[`json filters to the first two entries 1`] = ` +[ + "{ + "version": "https://jsonfeed.org/version/1", + "title": "Hello Blog", + "home_page_url": "https://docusaurus.io/myBaseUrl/blog", + "description": "Hello Blog", + "items": [ + { + "id": "https://docusaurus.io/myBaseUrl/blog/blog-with-links", + "content_html": "

absolute full url

/n

absolute pathname

/n

relative pathname

/n

md link

/n

anchor

/n

relative pathname + anchor

/n

/n

\\"\\"

/n/n", + "url": "https://docusaurus.io/myBaseUrl/blog/blog-with-links", + "title": "test links", + "summary": "absolute full url", + "date_modified": "2023-07-23T00:00:00.000Z", + "tags": [] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post", + "content_html": "

Test MDX with require calls

/n/n/n/n/n", + "url": "https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post", + "title": "MDX Blog Sample with require calls", + "summary": "Test MDX with require calls", + "date_modified": "2021-03-06T00:00:00.000Z", + "tags": [] + } + ] +}", +] +`; + +exports[`json filters to the first two entries using limit 1`] = ` +[ + "{ + "version": "https://jsonfeed.org/version/1", + "title": "Hello Blog", + "home_page_url": "https://docusaurus.io/myBaseUrl/blog", + "description": "Hello Blog", + "items": [ + { + "id": "https://docusaurus.io/myBaseUrl/blog/blog-with-links", + "content_html": "

absolute full url

/n

absolute pathname

/n

relative pathname

/n

md link

/n

anchor

/n

relative pathname + anchor

/n

/n

\\"\\"

/n/n", + "url": "https://docusaurus.io/myBaseUrl/blog/blog-with-links", + "title": "test links", + "summary": "absolute full url", + "date_modified": "2023-07-23T00:00:00.000Z", + "tags": [] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post", + "content_html": "

Test MDX with require calls

/n/n/n/n/n", + "url": "https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post", + "title": "MDX Blog Sample with require calls", + "summary": "Test MDX with require calls", + "date_modified": "2021-03-06T00:00:00.000Z", + "tags": [] + } + ] +}", +] +`; + +exports[`json has custom xslt files for feed 1`] = ` +[ + "{ + "version": "https://jsonfeed.org/version/1", + "title": "Hello Blog", + "home_page_url": "https://docusaurus.io/myBaseUrl/blog", + "description": "Hello Blog", + "items": [ + { + "id": "https://docusaurus.io/myBaseUrl/blog/blog-with-links", + "content_html": "

absolute full url

/n

absolute pathname

/n

relative pathname

/n

md link

/n

anchor

/n

relative pathname + anchor

/n

/n

\\"\\"

/n/n", + "url": "https://docusaurus.io/myBaseUrl/blog/blog-with-links", + "title": "test links", + "summary": "absolute full url", + "date_modified": "2023-07-23T00:00:00.000Z", + "tags": [] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post", + "content_html": "

Test MDX with require calls

/n/n/n/n/n", + "url": "https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post", + "title": "MDX Blog Sample with require calls", + "summary": "Test MDX with require calls", + "date_modified": "2021-03-06T00:00:00.000Z", + "tags": [] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/mdx-blog-post", + "content_html": "

HTML Heading 1

/n

HTML Heading 2

/n

HTML Paragraph

/n/n/n

Import DOM

/n

Heading 1

/n

Heading 2

/n

Heading 3

/n

Heading 4

/n
Heading 5
/n
    /n
  • list1
  • /n
  • list2
  • /n
  • list3
  • /n
/n
    /n
  • list1
  • /n
  • list2
  • /n
  • list3
  • /n
/n

Normal Text Italics Text Bold Text

/n

link \\"image\\"

", + "url": "https://docusaurus.io/myBaseUrl/blog/mdx-blog-post", + "title": "Full Blog Sample", + "summary": "HTML Heading 1", + "date_modified": "2021-03-05T00:00:00.000Z", + "tags": [] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/hey/my super path/héllô", + "content_html": "

complex url slug

", + "url": "https://docusaurus.io/myBaseUrl/blog/hey/my super path/héllô", + "title": "Complex Slug", + "summary": "complex url slug", + "date_modified": "2020-08-16T00:00:00.000Z", + "tags": [ + "date", + "complex" + ] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/simple/slug", + "content_html": "

simple url slug

", + "url": "https://docusaurus.io/myBaseUrl/blog/simple/slug", + "title": "Simple Slug", + "summary": "simple url slug", + "date_modified": "2020-08-15T00:00:00.000Z", + "author": { + "name": "Sébastien Lorber", + "url": "https://sebastienlorber.com" + }, + "tags": [] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/heading-as-title", + "content_html": "", + "url": "https://docusaurus.io/myBaseUrl/blog/heading-as-title", + "title": "some heading", + "date_modified": "2019-01-02T00:00:00.000Z", + "tags": [] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/date-matter", + "content_html": "

date inside front matter

", + "url": "https://docusaurus.io/myBaseUrl/blog/date-matter", + "title": "date-matter", + "summary": "date inside front matter", + "date_modified": "2019-01-01T00:00:00.000Z", + "tags": [ + "date" + ] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/2018/12/14/Happy-First-Birthday-Slash", + "content_html": "

Happy birthday! (translated)

", + "url": "https://docusaurus.io/myBaseUrl/blog/2018/12/14/Happy-First-Birthday-Slash", + "title": "Happy 1st Birthday Slash! (translated)", + "summary": "Happy birthday! (translated)", + "date_modified": "2018-12-14T00:00:00.000Z", + "author": { + "name": "Yangshun Tay (translated)" + }, + "tags": [] + } + ] +}", +] +`; + +exports[`json has feed item for each post 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", + "home_page_url": "https://docusaurus.io/myBaseUrl/blog", + "description": "Hello Blog", + "items": [ + { + "id": "https://docusaurus.io/myBaseUrl/blog/blog-with-links", + "content_html": "

absolute full url

/n

absolute pathname

/n

relative pathname

/n

md link

/n

anchor

/n

relative pathname + anchor

/n

/n

\\"\\"

/n/n", + "url": "https://docusaurus.io/myBaseUrl/blog/blog-with-links", + "title": "test links", + "summary": "absolute full url", + "date_modified": "2023-07-23T00:00:00.000Z", + "tags": [] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post", + "content_html": "

Test MDX with require calls

/n/n/n/n/n", + "url": "https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post", + "title": "MDX Blog Sample with require calls", + "summary": "Test MDX with require calls", + "date_modified": "2021-03-06T00:00:00.000Z", + "tags": [] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/mdx-blog-post", + "content_html": "

HTML Heading 1

/n

HTML Heading 2

/n

HTML Paragraph

/n/n/n

Import DOM

/n

Heading 1

/n

Heading 2

/n

Heading 3

/n

Heading 4

/n
Heading 5
/n
    /n
  • list1
  • /n
  • list2
  • /n
  • list3
  • /n
/n
    /n
  • list1
  • /n
  • list2
  • /n
  • list3
  • /n
/n

Normal Text Italics Text Bold Text

/n

link \\"image\\"

", + "url": "https://docusaurus.io/myBaseUrl/blog/mdx-blog-post", + "title": "Full Blog Sample", + "summary": "HTML Heading 1", + "date_modified": "2021-03-05T00:00:00.000Z", + "tags": [] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/hey/my super path/héllô", + "content_html": "

complex url slug

", + "url": "https://docusaurus.io/myBaseUrl/blog/hey/my super path/héllô", + "title": "Complex Slug", + "summary": "complex url slug", + "date_modified": "2020-08-16T00:00:00.000Z", + "tags": [ + "date", + "complex" + ] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/simple/slug", + "content_html": "

simple url slug

", + "url": "https://docusaurus.io/myBaseUrl/blog/simple/slug", + "title": "Simple Slug", + "summary": "simple url slug", + "date_modified": "2020-08-15T00:00:00.000Z", + "author": { + "name": "Sébastien Lorber", + "url": "https://sebastienlorber.com" + }, + "tags": [] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/heading-as-title", + "content_html": "", + "url": "https://docusaurus.io/myBaseUrl/blog/heading-as-title", + "title": "some heading", + "date_modified": "2019-01-02T00:00:00.000Z", + "tags": [] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/date-matter", + "content_html": "

date inside front matter

", + "url": "https://docusaurus.io/myBaseUrl/blog/date-matter", + "title": "date-matter", + "summary": "date inside front matter", + "date_modified": "2019-01-01T00:00:00.000Z", + "tags": [ + "date" + ] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/2018/12/14/Happy-First-Birthday-Slash", + "content_html": "

Happy birthday! (translated)

", + "url": "https://docusaurus.io/myBaseUrl/blog/2018/12/14/Happy-First-Birthday-Slash", + "title": "Happy 1st Birthday Slash! (translated)", + "summary": "Happy birthday! (translated)", + "date_modified": "2018-12-14T00:00:00.000Z", + "author": { + "name": "Yangshun Tay (translated)" + }, + "tags": [] + } + ] +}", +] +`; + +exports[`json has xslt files for feed 1`] = ` +[ + "{ + "version": "https://jsonfeed.org/version/1", + "title": "Hello Blog", + "home_page_url": "https://docusaurus.io/myBaseUrl/blog", + "description": "Hello Blog", + "items": [ + { + "id": "https://docusaurus.io/myBaseUrl/blog/blog-with-links", + "content_html": "

absolute full url

/n

absolute pathname

/n

relative pathname

/n

md link

/n

anchor

/n

relative pathname + anchor

/n

/n

\\"\\"

/n/n", + "url": "https://docusaurus.io/myBaseUrl/blog/blog-with-links", + "title": "test links", + "summary": "absolute full url", + "date_modified": "2023-07-23T00:00:00.000Z", + "tags": [] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post", + "content_html": "

Test MDX with require calls

/n/n/n/n/n", + "url": "https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post", + "title": "MDX Blog Sample with require calls", + "summary": "Test MDX with require calls", + "date_modified": "2021-03-06T00:00:00.000Z", + "tags": [] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/mdx-blog-post", + "content_html": "

HTML Heading 1

/n

HTML Heading 2

/n

HTML Paragraph

/n/n/n

Import DOM

/n

Heading 1

/n

Heading 2

/n

Heading 3

/n

Heading 4

/n
Heading 5
/n
    /n
  • list1
  • /n
  • list2
  • /n
  • list3
  • /n
/n
    /n
  • list1
  • /n
  • list2
  • /n
  • list3
  • /n
/n

Normal Text Italics Text Bold Text

/n

link \\"image\\"

", + "url": "https://docusaurus.io/myBaseUrl/blog/mdx-blog-post", + "title": "Full Blog Sample", + "summary": "HTML Heading 1", + "date_modified": "2021-03-05T00:00:00.000Z", + "tags": [] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/hey/my super path/héllô", + "content_html": "

complex url slug

", + "url": "https://docusaurus.io/myBaseUrl/blog/hey/my super path/héllô", + "title": "Complex Slug", + "summary": "complex url slug", + "date_modified": "2020-08-16T00:00:00.000Z", + "tags": [ + "date", + "complex" + ] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/simple/slug", + "content_html": "

simple url slug

", + "url": "https://docusaurus.io/myBaseUrl/blog/simple/slug", + "title": "Simple Slug", + "summary": "simple url slug", + "date_modified": "2020-08-15T00:00:00.000Z", + "author": { + "name": "Sébastien Lorber", + "url": "https://sebastienlorber.com" + }, + "tags": [] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/heading-as-title", + "content_html": "", + "url": "https://docusaurus.io/myBaseUrl/blog/heading-as-title", + "title": "some heading", + "date_modified": "2019-01-02T00:00:00.000Z", + "tags": [] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/date-matter", + "content_html": "

date inside front matter

", + "url": "https://docusaurus.io/myBaseUrl/blog/date-matter", + "title": "date-matter", + "summary": "date inside front matter", + "date_modified": "2019-01-01T00:00:00.000Z", + "tags": [ + "date" + ] + }, + { + "id": "https://docusaurus.io/myBaseUrl/blog/2018/12/14/Happy-First-Birthday-Slash", + "content_html": "

Happy birthday! (translated)

", + "url": "https://docusaurus.io/myBaseUrl/blog/2018/12/14/Happy-First-Birthday-Slash", + "title": "Happy 1st Birthday Slash! (translated)", + "summary": "Happy birthday! (translated)", + "date_modified": "2018-12-14T00:00:00.000Z", + "author": { + "name": "Yangshun Tay (translated)" + }, + "tags": [] + } + ] +}", +] +`; + +exports[`rss filters to the first two entries 1`] = ` +[ + " + + + Hello Blog + https://docusaurus.io/myBaseUrl/blog + Hello Blog + Sun, 23 Jul 2023 00:00:00 GMT + https://validator.w3.org/feed/docs/rss2.html + https://github.com/jpmonette/feed + en + Copyright + + <![CDATA[test links]]> + https://docusaurus.io/myBaseUrl/blog/blog-with-links + https://docusaurus.io/myBaseUrl/blog/blog-with-links + Sun, 23 Jul 2023 00:00:00 GMT + + absolute full url

+

absolute pathname

+

relative pathname

+

md link

+

anchor

+

relative pathname + anchor

+

+

+ +]]>
+
+ + <![CDATA[MDX Blog Sample with require calls]]> + https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post + https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post + Sat, 06 Mar 2021 00:00:00 GMT + + Test MDX with require calls

+ + + + +]]>
+
+
+
", +] +`; + +exports[`rss filters to the first two entries using limit 1`] = ` +[ + " + + + Hello Blog + https://docusaurus.io/myBaseUrl/blog + Hello Blog + Sun, 23 Jul 2023 00:00:00 GMT + https://validator.w3.org/feed/docs/rss2.html + https://github.com/jpmonette/feed + en + Copyright + + <![CDATA[test links]]> + https://docusaurus.io/myBaseUrl/blog/blog-with-links + https://docusaurus.io/myBaseUrl/blog/blog-with-links + Sun, 23 Jul 2023 00:00:00 GMT + + absolute full url

+

absolute pathname

+

relative pathname

+

md link

+

anchor

+

relative pathname + anchor

+

+

+ +]]>
+
+ + <![CDATA[MDX Blog Sample with require calls]]> + https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post + https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post + Sat, 06 Mar 2021 00:00:00 GMT + + Test MDX with require calls

+ + + + +]]>
+
+
+
", +] +`; + +exports[`rss has custom 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; +} +", + " + + + Hello Blog + https://docusaurus.io/myBaseUrl/blog + Hello Blog + Sun, 23 Jul 2023 00:00:00 GMT + https://validator.w3.org/feed/docs/rss2.html + https://github.com/jpmonette/feed + en + Copyright + + <![CDATA[test links]]> + https://docusaurus.io/myBaseUrl/blog/blog-with-links + https://docusaurus.io/myBaseUrl/blog/blog-with-links + Sun, 23 Jul 2023 00:00:00 GMT + + absolute full url

+

absolute pathname

+

relative pathname

+

md link

+

anchor

relative pathname + anchor

@@ -469,6 +1381,78 @@ exports[`rss filters to the first two entries using limit 1`] = ` ]]>
+ + <![CDATA[Full Blog Sample]]> + https://docusaurus.io/myBaseUrl/blog/mdx-blog-post + https://docusaurus.io/myBaseUrl/blog/mdx-blog-post + Fri, 05 Mar 2021 00:00:00 GMT + + HTML Heading 1 +

HTML Heading 2

+

HTML Paragraph

+ + +

Import DOM

+

Heading 1

+

Heading 2

+

Heading 3

+

Heading 4

+
Heading 5
+
    +
  • list1
  • +
  • list2
  • +
  • list3
  • +
+
    +
  • list1
  • +
  • list2
  • +
  • list3
  • +
+

Normal Text Italics Text Bold Text

+

link image

]]>
+
+ + <![CDATA[Complex Slug]]> + https://docusaurus.io/myBaseUrl/blog/hey/my super path/héllô + https://docusaurus.io/myBaseUrl/blog/hey/my super path/héllô + Sun, 16 Aug 2020 00:00:00 GMT + + complex url slug

]]>
+ date + complex +
+ + <![CDATA[Simple Slug]]> + https://docusaurus.io/myBaseUrl/blog/simple/slug + https://docusaurus.io/myBaseUrl/blog/simple/slug + Sat, 15 Aug 2020 00:00:00 GMT + + simple url slug

]]>
+
+ + <![CDATA[some heading]]> + https://docusaurus.io/myBaseUrl/blog/heading-as-title + https://docusaurus.io/myBaseUrl/blog/heading-as-title + Wed, 02 Jan 2019 00:00:00 GMT + + + <![CDATA[date-matter]]> + https://docusaurus.io/myBaseUrl/blog/date-matter + https://docusaurus.io/myBaseUrl/blog/date-matter + Tue, 01 Jan 2019 00:00:00 GMT + + date inside front matter

]]>
+ date +
+ + <![CDATA[Happy 1st Birthday Slash! (translated)]]> + https://docusaurus.io/myBaseUrl/blog/2018/12/14/Happy-First-Birthday-Slash + https://docusaurus.io/myBaseUrl/blog/2018/12/14/Happy-First-Birthday-Slash + Fri, 14 Dec 2018 00:00:00 GMT + + Happy birthday! (translated)

]]>
+ lorber.sebastien@gmail.com (Sébastien Lorber (translated)) +
", ] @@ -476,7 +1460,265 @@ exports[`rss filters to the first two entries using limit 1`] = ` exports[`rss has feed item for each post 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.
+

+
+ + + + + + + + + + +
+ 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. + */ + +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; +} +", + " + + + Hello Blog + https://docusaurus.io/myBaseUrl/blog + Hello Blog + Sun, 23 Jul 2023 00:00:00 GMT + https://validator.w3.org/feed/docs/rss2.html + https://github.com/jpmonette/feed + en + Copyright + + <![CDATA[test links]]> + https://docusaurus.io/myBaseUrl/blog/blog-with-links + https://docusaurus.io/myBaseUrl/blog/blog-with-links + Sun, 23 Jul 2023 00:00:00 GMT + + absolute full url

+

absolute pathname

+

relative pathname

+

md link

+

anchor

+

relative pathname + anchor

+

+

+ +]]>
+
+ + <![CDATA[MDX Blog Sample with require calls]]> + https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post + https://docusaurus.io/myBaseUrl/blog/mdx-require-blog-post + Sat, 06 Mar 2021 00:00:00 GMT + + Test MDX with require calls

+ + + + +]]>
+
+ + <![CDATA[Full Blog Sample]]> + https://docusaurus.io/myBaseUrl/blog/mdx-blog-post + https://docusaurus.io/myBaseUrl/blog/mdx-blog-post + Fri, 05 Mar 2021 00:00:00 GMT + + HTML Heading 1 +

HTML Heading 2

+

HTML Paragraph

+ + +

Import DOM

+

Heading 1

+

Heading 2

+

Heading 3

+

Heading 4

+
Heading 5
+
    +
  • list1
  • +
  • list2
  • +
  • list3
  • +
+
    +
  • list1
  • +
  • list2
  • +
  • list3
  • +
+

Normal Text Italics Text Bold Text

+

link image

]]>
+
+ + <![CDATA[Complex Slug]]> + https://docusaurus.io/myBaseUrl/blog/hey/my super path/héllô + https://docusaurus.io/myBaseUrl/blog/hey/my super path/héllô + Sun, 16 Aug 2020 00:00:00 GMT + + complex url slug

]]>
+ date + complex +
+ + <![CDATA[Simple Slug]]> + https://docusaurus.io/myBaseUrl/blog/simple/slug + https://docusaurus.io/myBaseUrl/blog/simple/slug + Sat, 15 Aug 2020 00:00:00 GMT + + simple url slug

]]>
+
+ + <![CDATA[some heading]]> + https://docusaurus.io/myBaseUrl/blog/heading-as-title + https://docusaurus.io/myBaseUrl/blog/heading-as-title + Wed, 02 Jan 2019 00:00:00 GMT + + + <![CDATA[date-matter]]> + https://docusaurus.io/myBaseUrl/blog/date-matter + https://docusaurus.io/myBaseUrl/blog/date-matter + Tue, 01 Jan 2019 00:00:00 GMT + + date inside front matter

]]>
+ date +
+ + <![CDATA[Happy 1st Birthday Slash! (translated)]]> + https://docusaurus.io/myBaseUrl/blog/2018/12/14/Happy-First-Birthday-Slash + https://docusaurus.io/myBaseUrl/blog/2018/12/14/Happy-First-Birthday-Slash + Fri, 14 Dec 2018 00:00:00 GMT + + Happy birthday! (translated)

]]>
+ lorber.sebastien@gmail.com (Sébastien Lorber (translated)) +
+
+
", +] +`; + +exports[`rss has xslt files for feed 1`] = ` +[ + " Hello Blog 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 f928296bf9df..b11cb7c5460c 100644 --- a/packages/docusaurus-plugin-content-blog/src/__tests__/feed.test.ts +++ b/packages/docusaurus-plugin-content-blog/src/__tests__/feed.test.ts @@ -238,4 +238,96 @@ describe.each(['atom', 'rss', 'json'])('%s', (feedType) => { ).toMatchSnapshot(); fsMock.mockClear(); }); + + it('has xslt files for feed', async () => { + const siteDir = path.join(__dirname, '__fixtures__', 'website'); + const outDir = path.join(siteDir, 'build-snap'); + const siteConfig = { + title: 'Hello', + baseUrl: '/myBaseUrl/', + url: 'https://docusaurus.io', + favicon: 'image/favicon.ico', + }; + + // Build is quite difficult to mock, so we built the blog beforehand and + // copied the output to the fixture... + await testGenerateFeeds( + { + siteDir, + siteConfig, + i18n: DefaultI18N, + outDir, + } as LoadContext, + { + path: 'blog', + routeBasePath: 'blog', + tagsBasePath: 'tags', + authorsMapPath: 'authors.yml', + include: DEFAULT_OPTIONS.include, + exclude: DEFAULT_OPTIONS.exclude, + feedOptions: { + type: [feedType], + copyright: 'Copyright', + xsl: { + enable: true, + }, + }, + readingTime: ({content, defaultReadingTime}) => + defaultReadingTime({content}), + truncateMarker: //, + } as PluginOptions, + ); + + expect( + fsMock.mock.calls.map((call) => call[1] as string), + ).toMatchSnapshot(); + fsMock.mockClear(); + }); + + it('has custom xslt files for feed', async () => { + const siteDir = path.join(__dirname, '__fixtures__', 'website'); + const outDir = path.join(siteDir, 'build-snap'); + const siteConfig = { + title: 'Hello', + baseUrl: '/myBaseUrl/', + url: 'https://docusaurus.io', + favicon: 'image/favicon.ico', + }; + + // Build is quite difficult to mock, so we built the blog beforehand and + // copied the output to the fixture... + await testGenerateFeeds( + { + siteDir, + siteConfig, + i18n: DefaultI18N, + outDir, + } as LoadContext, + { + path: 'blog', + routeBasePath: 'blog', + tagsBasePath: 'tags', + authorsMapPath: 'authors.yml', + include: DEFAULT_OPTIONS.include, + exclude: DEFAULT_OPTIONS.exclude, + feedOptions: { + type: [feedType], + copyright: 'Copyright', + xsl: { + enable: true, + rssStylesheet: 'custom-rss.stylesheet.xsl', + atomStylesheet: 'custom-atom.stylesheet.xsl', + }, + }, + readingTime: ({content, defaultReadingTime}) => + defaultReadingTime({content}), + truncateMarker: //, + } as PluginOptions, + ); + + expect( + fsMock.mock.calls.map((call) => call[1] as string), + ).toMatchSnapshot(); + fsMock.mockClear(); + }); }); diff --git a/packages/docusaurus-plugin-content-blog/src/feed.ts b/packages/docusaurus-plugin-content-blog/src/feed.ts index 4f4c2a6f5a3a..12c67957e183 100644 --- a/packages/docusaurus-plugin-content-blog/src/feed.ts +++ b/packages/docusaurus-plugin-content-blog/src/feed.ts @@ -20,6 +20,7 @@ import type { Author, BlogPost, BlogFeedItem, + IXslParams, } from '@docusaurus/plugin-content-blog'; async function generateBlogFeed({ @@ -165,16 +166,127 @@ async function defaultCreateFeedItems({ ); } +/** + * @description addXmlStyleSheet appends a xsl stylesheet to the generated xml feed + * @param feedDetails array containing blog feed content and name of file + * @param generatePath path where the file would be copied in website + */ +async function addXmlStyleSheet( + feedDetails: string[], + generatePath: string, + stylesheet: string, +) { + const DEFAULT_RSS_FEED = 'rss-feed.xslt'; + const DEFAULT_ATOM_FEED = 'atom-feed.xslt'; + + if (!feedDetails[0]) { + return feedDetails; + } + + if (feedDetails[1] === 'rss.xml') { + let xsltLink = ``; + + if (stylesheet) { + xsltLink = ``; + } + + feedDetails[0] = feedDetails[0]?.replace( + '', + xsltLink, + ); + + const rssXsltSourceFilePath = path.join( + __dirname, + '../assets/rss-feed.xslt', + ); + const rssStylesheetSourceFilePath = path.join( + __dirname, + '../assets/rss-feed.stylesheet.css', + ); + + const rssXsltDestinationFilePath = path.join(generatePath, 'rss-feed.xslt'); + const rssStylesheetDestinationFilePath = path.join( + generatePath, + 'rss-feed.stylesheet.css', + ); + + // output rss xslt file to website + fs.readFile(rssXsltSourceFilePath, 'utf8').then((xsltContent) => + fs.outputFile(rssXsltDestinationFilePath, xsltContent, 'utf-8'), + ); + + // output rss stylesheet to website + fs.readFile(rssStylesheetSourceFilePath, 'utf8').then( + (stylesheetContent) => { + fs.outputFile( + rssStylesheetDestinationFilePath, + stylesheetContent, + 'utf-8', + ); + }, + ); + } else if (feedDetails[1] === 'atom.xml') { + let xsltLink = ``; + + if (stylesheet) { + xsltLink = ``; + } + + feedDetails[0] = feedDetails[0]?.replace( + '', + xsltLink, + ); + + const atomXsltSourceFilePath = path.join( + __dirname, + '../assets/atom-feed.xslt', + ); + const atomStylesheetSourceFilePath = path.join( + __dirname, + '../assets/atom-feed.stylesheet.css', + ); + + const atomXsltDestinationFilePath = path.join( + generatePath, + 'atom-feed.xslt', + ); + const atomStylesheetDestinationFilePath = path.join( + generatePath, + 'atom-feed.stylesheet.css', + ); + + // output rss xslt file to website + fs.readFile(atomXsltSourceFilePath, 'utf8').then((xsltContent) => + fs.outputFile(atomXsltDestinationFilePath, xsltContent, 'utf-8'), + ); + + // output rss stylesheet to website + fs.readFile(atomStylesheetSourceFilePath, 'utf8').then( + (stylesheetContent) => { + fs.outputFile( + atomStylesheetDestinationFilePath, + stylesheetContent, + 'utf-8', + ); + }, + ); + } + + return feedDetails; +} + async function createBlogFeedFile({ feed, feedType, generatePath, + addXSL, }: { feed: Feed; feedType: FeedType; generatePath: string; + addXSL?: IXslParams; }) { - const feedDetails = (() => { + let feedDetails = (() => { switch (feedType) { case 'rss': return [feed.rss2(), 'rss.xml']; @@ -187,13 +299,13 @@ async function createBlogFeedFile({ } })(); try { - const xsltLink = - ''; - - if (feedDetails[1] !== 'feed.json' && feedDetails[0]) { - feedDetails[0] = feedDetails[0]?.replace( - '', - xsltLink, + if (addXSL?.enable) { + feedDetails = await addXmlStyleSheet( + feedDetails, + generatePath, + feedDetails[1] === 'atom.xml' + ? addXSL.atomStylesheet + : addXSL.rssStylesheet, ); } @@ -248,6 +360,7 @@ export async function createBlogFeedFiles({ feed, feedType, generatePath: path.join(outDir, options.routeBasePath), + addXSL: options.feedOptions.xsl, }), ), ); diff --git a/packages/docusaurus-plugin-content-blog/src/options.ts b/packages/docusaurus-plugin-content-blog/src/options.ts index 5b9889399a10..7fdcd9c06741 100644 --- a/packages/docusaurus-plugin-content-blog/src/options.ts +++ b/packages/docusaurus-plugin-content-blog/src/options.ts @@ -111,6 +111,11 @@ const PluginOptionSchema = Joi.object({ ) .allow(null) .default(DEFAULT_OPTIONS.feedOptions.type), + xsl: Joi.object({ + enable: Joi.boolean(), + atomStylesheet: Joi.string(), + rssStylesheet: Joi.string(), + }), title: Joi.string().allow(''), description: Joi.string().allow(''), // Only add default value when user actually wants a feed (type is not null) diff --git a/packages/docusaurus-plugin-content-blog/src/plugin-content-blog.d.ts b/packages/docusaurus-plugin-content-blog/src/plugin-content-blog.d.ts index b1915f75196f..f57c07eed02c 100644 --- a/packages/docusaurus-plugin-content-blog/src/plugin-content-blog.d.ts +++ b/packages/docusaurus-plugin-content-blog/src/plugin-content-blog.d.ts @@ -256,6 +256,13 @@ yarn workspace v1.22.19image` is a collocated image path, this entry will be the }) => string | undefined; export type FeedType = 'rss' | 'atom' | 'json'; + + export interface IXslParams { + enable: boolean; + rssStylesheet: string; + atomStylesheet: string; + } + /** * Normalized feed options used within code. */ @@ -274,6 +281,8 @@ yarn workspace v1.22.19image` is a collocated image path, this entry will be the createFeedItems?: CreateFeedItemsFn; /** Limits the feed to the specified number of posts, false|null for all */ limit?: number | false | null; + /** Enable xsl stylesheet */ + xsl?: IXslParams; }; type DefaultCreateFeedItemsParams = { diff --git a/website/_dogfooding/dogfooding.config.js b/website/_dogfooding/dogfooding.config.js index a6e2bcde9592..7b5cf84164f8 100644 --- a/website/_dogfooding/dogfooding.config.js +++ b/website/_dogfooding/dogfooding.config.js @@ -67,6 +67,11 @@ const dogfoodingPluginInstances = [ type: 'all', title: 'Docusaurus Tests Blog', copyright: `Copyright © ${new Date().getFullYear()} Facebook, Inc.`, + xsl: { + enable: true, + rssStylesheet: 'custom-rss.stylesheet.xslt', + atomStylesheet: 'custom-atom.stylesheet.xslt', + }, }, readingTime: ({content, frontMatter, defaultReadingTime}) => frontMatter.hide_reading_time diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 087e9716cd3c..6ef97f69580b 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -420,6 +420,9 @@ module.exports = async function createConfigAsync() { feedOptions: { type: 'all', copyright: `Copyright © ${new Date().getFullYear()} Facebook, Inc.`, + xsl: { + enable: true + } }, blogSidebarCount: 'ALL', blogSidebarTitle: 'All our posts', diff --git a/website/static/custom-atom.stylesheet.xslt b/website/static/custom-atom.stylesheet.xslt new file mode 100644 index 000000000000..3f37d7419c43 --- /dev/null +++ b/website/static/custom-atom.stylesheet.xslt @@ -0,0 +1,65 @@ + + + + + + + + + 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 +
+
+ +
+
+
+
+
+ + +
+ +
\ No newline at end of file diff --git a/website/static/custom-rss.stylesheet.xslt b/website/static/custom-rss.stylesheet.xslt new file mode 100644 index 000000000000..4159dab155d0 --- /dev/null +++ b/website/static/custom-rss.stylesheet.xslt @@ -0,0 +1,66 @@ + + + + + + + + + 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.
+

+
+ + + + + + + + + + +
+ Custom RSS Feed Preview

+

+ +

+

Description:

+
+

Recent Posts

+
+ +
+ + + +
Published on +
+
+ +
+
+
+
+
+ + +
+ +
\ No newline at end of file diff --git a/website/static/rss.xslt b/website/static/rss.xslt deleted file mode 100644 index 40cb219efc74..000000000000 --- a/website/static/rss.xslt +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - Blog Information - - - -
-
-

-

Description:

-

Last Build Date:

-

Language:

-
-

Recent Posts

- -
- - -
- -
diff --git a/website/static/styles.css b/website/static/styles.css deleted file mode 100644 index 55d607bb351a..000000000000 --- a/website/static/styles.css +++ /dev/null @@ -1,35 +0,0 @@ -/** - * 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. - */ - -.markdown { - padding: 4rem; - margin: auto; - text-align: center; - /* stylelint-disable-next-line font-family-name-quotes */ - font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu; - line-height: 1.65; -} - -.col, -.container { - padding: 0 var(--ifm-spacing-horizontal); - width: 100%; -} - -.markdown li, -body { - word-wrap: break-word; - list-style: none; -} - -body, -ol ol, -ol ul, -ul ol, -ul ul { - margin: 0 auto; -} diff --git a/website/static/xslt-stylesheet.css b/website/static/xslt-stylesheet.css new file mode 100644 index 000000000000..c016178d9007 --- /dev/null +++ b/website/static/xslt-stylesheet.css @@ -0,0 +1,76 @@ +/** + * 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; +}