Notenik
Do More With Your Notes

Adventures with Notenik

Adding an RSS Feed to Your Site

Adventure # 3 • Friday, July 5, 2024

An RSS feed is one kind of web feed that you can use on your site. This is the oldest of the various feed formats, and is XML-based.

Here is an example of a Merge Template one might use to generate an RSS feed.

<?output "../rss.xml"?>
<rss version="2.0">
  <channel>
	<title>Adventures with Notenik</title>
	<link>https://notenik.app</link>
	<description>The Latest Adventures with Notenik</description>
	<language>en</language>
<?nextrec?>
	<item>
	  <title>=$title&x$=</title>
	  <link>https://notenik.app/adventures/=$date&yyyy-MM-dd$=-=$title&f$=.html</link>
	  <guid>https://notenik.app/adventures/=$date&yyyy-MM-dd$=-=$title&f$=.html</guid>
	  <pubDate>=$date&EEE, dd MMM yyyy$= 12:00:00 -0700</pubDate>
	  <description>
		  =$teaser&xo-$=
	  </description>
	</item>
<?loop?>
  </channel>
</rss>

Notice the use of the XML - X variable modifier in several places to make sure that your variable values are suitably encoded for use within XML.

One would then want to include a line such as the following within the head section of the HTML pages on your site.

    <link rel="alternate" type="application/rss+xml" title="RSS feed for Adventures with Notenik" href="rss.xml" />

tags: , ,

Prior Adventure: Adding a Web Feed to Your Site | 4 Jul, 2024

Latest EntriesArchive by Tag