Skip to content

Commit 97f0693

Browse files
author
Farzad Hayatbakhsh
committed
DOC-2608: Initial prototype - no posts yet
1 parent 0c7c2a8 commit 97f0693

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

antora-playbook-local.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,8 @@ ui:
1717
asciidoc:
1818
extensions:
1919
- '@tinymce/antora-extension-livedemos'
20+
antora:
21+
extensions:
22+
- './rssfeed.cjs'
2023
runtime:
2124
fetch: true

rssfeed.cjs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
"use strict";
2+
3+
module.exports.register = function () {
4+
this.on("beforePublish", ({ siteCatalog, contentCatalog, playbook }) => {
5+
const siteLink = playbook.site.url;
6+
7+
// Find page
8+
const page = contentCatalog.findBy({
9+
basename: "changelog.adoc",
10+
})[0];
11+
12+
// Get page attributes
13+
const attributes = page.asciidoc.attributes;
14+
const {
15+
productname: productName,
16+
productmajorversion: productMajorVersion,
17+
doctitle: pageTitle,
18+
description: pageDescription,
19+
docname: pageName,
20+
} = attributes;
21+
22+
// Get page content
23+
const content = page.contents.toString();
24+
25+
console.log("Attributes:", attributes);
26+
console.log("Content:", content);
27+
28+
// Create RSS feed
29+
const rss = `<?xml version="1.0" encoding="UTF-8" ?>
30+
<rss version="2.0">
31+
32+
<channel>
33+
<title>${productName} ${productMajorVersion} ${pageTitle}</title>
34+
<link>${siteLink}/${pageName}</link>
35+
<description>${pageDescription}</description>
36+
<item>
37+
<title>RSS Tutorial</title>
38+
<link>https://www.w3schools.com/xml/xml_rss.asp</link>
39+
<description>New RSS tutorial on W3Schools</description>
40+
</item>
41+
<item>
42+
<title>XML Tutorial</title>
43+
<link>https://www.w3schools.com/xml</link>
44+
<description>New XML tutorial on W3Schools</description>
45+
</item>
46+
</channel>
47+
48+
</rss>`;
49+
50+
// Add RSS feed to site catalog
51+
siteCatalog.addFile({
52+
contents: Buffer.from(rss),
53+
out: { path: "rss.xml" },
54+
});
55+
});
56+
};

0 commit comments

Comments
 (0)