This blog has an atom feed. (But, it doens't have an RSS feed. (yet)) The way I made this feed way using a javascript script (is that the correct term? sounds wrong, but I can't be bothered correcting it) that I made. It now occours to me that perhaps not every person has the amazing technical skills I have(/hyp /j), so I decided to publish said script for anyone to use. Here it is (and here):
Modify it to have what you want, if you want, or just use it as. It detects all h-entries on the page, so if you already have that set-up you shouldn't need to do much more. If you don't have h-entry set-up, visit the indie web, view the documentation, or copy the below template:
function generateFeed() {
const authorName = "Jane Doe"; // Your name
const linkToAuthor = "https://my.blog/jane"; // a link to you
const authorEmail = "jane@my.blog"; // your email (leave blank if you want to)
const mainURL = "https://my.blog/jane/blog"; // the link to view the http/s version of your blog
const mainUID = mainURL; // If you don't know what a UID is, leave this like this, otherwise put your blog's UID (a URL is a UID if it's prefixed with http/https).
const iconURL = "http://hosting.my.blog/icons/jane/feed/icon.png"; // the URL to the icon you want your blog to appear with
const feedTitle = "My Blog's feed"; // Blog's title
const feedURL = "https://my.blog/jane/atom.xml"; // where the generated file will be hosted
const feedDescription = "This is my blog"; // a description og your blog
const year = "2026"; // change to current year
const copyright = `Licensed under QAL 1.0 (Queer Agender License, Version 1.0) (https://venaticorum.name/QALv1.0.md) (c) ${year}, ${authorName} (${authorEmail})`; // Change to what ever license you have/want your blog to be under, or don't. Suggestions: "CC0", "CC NC-SA", "FHH", "GAL", "QAL"
const escapeXML = (value = "") =>
String(value).replace(/[&<>"']/g, (char) => ({
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'",
})[char]);
function getEntryValue(entry, selector, { html = false } = {}) {
const element = entry.querySelector(selector);
if (!element) return "";
if (html) return element.innerHTML.trim();
return (element.getAttribute("datetime") || element.textContent).trim();
}
function getAbsoluteURL(value, baseURL = document.baseURI) {
return (value) ? (new URL(value, baseURL).href) : "";
}
function entryToAtom(entry) {
const updated = entry.updated || entry.published;
return [
" <entry>",
` <id>${escapeXML(entry.uid)}</id>`,
` <published>${escapeXML(entry.published)}</published>`,
` <updated>${escapeXML(updated)}</updated>`,
` <link rel="alternate" type="text/html" href="${escapeXML(entry.url)}" />`,
` <title>${escapeXML(entry.title)}</title>`,
` <summary type="html">${escapeXML(entry.summary)}</summary>`,
` <content type="html">${escapeXML(entry.content)}</content>`,
" <author>",
` <name>${escapeXML(entry.author.name)}</name>`,
` <uri>${escapeXML(entry.author.uri)}</uri>`,
` <email>${escapeXML(entry.author.email)}</email>`,
" </author>",
" </entry>",
""
].join("\n");
}
function entryFromElement(element) {
const card = element.querySelector(".h-card");
const author = card
? {
name: getEntryValue(card, ".p-name"),
email: getEntryValue(card, ".u-email"),
url: getAbsoluteURL(getEntryValue(card, ".u-url")),
uri: getAbsoluteURL(getEntryValue(card, ".u-uid")),
}
: {
name: authorName,
email: authorEmail,
url: linkToAuthor,
uri: linkToAuthor,
};
return {
title: getEntryValue(element, ".p-name"),
summary: getEntryValue(element, ".p-summary"),
uid: getAbsoluteURL(getEntryValue(element, ".u-uid")),
url: getAbsoluteURL(getEntryValue(element, ".u-url")),
content: getEntryValue(element, ".e-content", { html: true }),
published: getEntryValue(element, "time.dt-published"),
updated: getEntryValue(element, "time.dt-updated"),
author,
};
}
function entriesFromPage() {
return Array.from(document.querySelectorAll(".h-entry"), entryFromElement);
}
function entriesToFeed(entries) {
let feedUpdated =
entries.map((entry) => entry.updated || entry.published)
.filter(Boolean)
.sort()
.at(-1) || new Date().toISOString();
feedUpdated = new Date().toISOString();
return [
'<?xml version="1.0" encoding="UTF-8"?>',
'<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom">',
` <id>${escapeXML(mainUID)}</id>`,
' <generator uri="https://venaticorum.name/blog/5">qciva:1:appl:atom-feed-builder/vh2.0</generator>',
` <updated>${escapeXML(feedUpdated)}</updated>`,
` <rights>${escapeXML(copyright)}</rights>`,
` <link rel="self" type="application/atom+xml" href="${escapeXML(feedURL)}" />`,
` <link rel="alternate" type="text/html" href="${escapeXML(mainURL)}" />`,
` <title>${escapeXML(feedTitle)}</title>`,
` <subtitle>${escapeXML(feedDescription)}</subtitle>`,
` <icon>${escapeXML(iconURL)}</icon>`,
"",
...entries.map(entryToAtom),
"</feed>",
].join("\n");
}
const generatedFeed = entriesToFeed(entriesFromPage());
console.log(generatedFeed);
// alert(generatedFeed)
return entriesToFeed(entriesFromPage());
}
generateFeed();
<div class="h-entry">Change:
<time datetime="ISOTIMEOFUPLOAD" class="dt-published">ISOTIMEOFUPLOAD</time>
<!-- <time datetime="ISOTIMEOFCHANGED" class="dt-updated">ISOTIMEOFCHANGED</time> -->
<h2 class="p-name">TITLE</h2>
<p class="p-summary">SUMMARY</p>
<p class="e-content">
ENTRY
</p>
<a class="u-url" href="uURL">uURL</a>
<!-- <p><span class="p-catagory">CAT1</span> <span class="p-catagory">CAT2</span> <span class="p-catagory">CAT3</span></p> -->
<!-- <a class="u-syndication" href="sURL">sURL</a> -->
</div>
https://venaticorum.name/permalink/blog/5
#indieweb #blog #rss #atom