This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/royale-website.git

commit 05741077c6088cae10ebf2dd53c65e83c32aae1b
Author: Josh Tynjala <[email protected]>
AuthorDate: Tue Jan 14 10:28:03 2025 -0800

    sitemap.xml and robots.txt
---
 .eleventy.js                |  4 ++++
 _includes/content-only.html |  1 +
 robots.txt                  |  1 +
 sitemap.liquid              | 12 ++++++++++++
 4 files changed, 18 insertions(+)

diff --git a/.eleventy.js b/.eleventy.js
index ad6493ac..80faa2cf 100644
--- a/.eleventy.js
+++ b/.eleventy.js
@@ -17,12 +17,16 @@ module.exports = function (eleventyConfig) {
     const content = post.replace(/(<([^>]+)>)/gi, "");
     return content.substr(0, content.lastIndexOf(" ", 200)) + "...";
   });
+  eleventyConfig.addFilter("dateToISOString", function (date) {
+    return date.toISOString();
+  });
 
   // copy these files to the output directory
   // if the directories contain any template extensions (such as.html or .md),
   // be sure to add the directory to .eleventyignore
   eleventyConfig.addPassthroughCopy("img");
   eleventyConfig.addPassthroughCopy(".htaccess");
+  eleventyConfig.addPassthroughCopy("robots.txt");
   eleventyConfig.addPassthroughCopy("asdoc");
   eleventyConfig.addPassthroughCopy("blog-examples");
   eleventyConfig.addPassthroughCopy("tourdejewel");
diff --git a/_includes/content-only.html b/_includes/content-only.html
new file mode 100644
index 00000000..e02a27c0
--- /dev/null
+++ b/_includes/content-only.html
@@ -0,0 +1 @@
+{{ content }}
\ No newline at end of file
diff --git a/robots.txt b/robots.txt
new file mode 100644
index 00000000..e087884e
--- /dev/null
+++ b/robots.txt
@@ -0,0 +1 @@
+Sitemap: /sitemap.xml
diff --git a/sitemap.liquid b/sitemap.liquid
new file mode 100644
index 00000000..9ba5f0ad
--- /dev/null
+++ b/sitemap.liquid
@@ -0,0 +1,12 @@
+---
+permalink: /sitemap.xml
+eleventyExcludeFromCollections: true
+layout: content-only.html
+---
+<?xml version="1.0" encoding="utf-8"?>
+<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9";>
+  {% for page in collections.all %}<url>
+    <loc>https://royale.apache.org{{ page.url | url }}</loc>
+    <lastmod>{{ page.date | dateToISOString }}</lastmod>
+  </url>{% endfor %}
+</urlset>
\ No newline at end of file

Reply via email to