diff options
author | Bradley Taunt <bt@btxx.org> | 2024-06-06 08:05:12 -0400 |
---|---|---|
committer | Bradley Taunt <bt@btxx.org> | 2024-06-06 08:05:12 -0400 |
commit | 6b742c459266b18e2b375b35205ce8a6c02f0452 (patch) | |
tree | b16fbb9a045e33dd6c97eb5ab72e6ff4d9237ea3 /build/rss-click/index.html |
Initial commit
Diffstat (limited to 'build/rss-click/index.html')
-rw-r--r-- | build/rss-click/index.html | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/build/rss-click/index.html b/build/rss-click/index.html new file mode 100644 index 0000000..1dbe5d9 --- /dev/null +++ b/build/rss-click/index.html @@ -0,0 +1,70 @@ +<!doctype html> +<html lang="en" id="top"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="icon" href="data:,"> + <title>Clickable Links Inside XML</title> + <link href="https://bt.ht/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" /> + <style>*{box-sizing:border-box;}body{font-family:sans-serif;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{overflow:auto;}table{text-align:left;width:100%;}</style> +</head> + +<nav> + <a href="#menu">Menu ↓</a> +</nav> + +<main> +<h1>Clickable Links Inside XML</h1> +<p>2022-06-20</p> +<p>With the recent patch to the Shinobi Website project, I thought it would be best to share my experience implementing clickable links inside a rendered XML RSS file directly through a browser. This is made possible thanks to the awesome power of XSL formatting.</p> +<p>Before we begin, it should be noted that both Safari for macOS and <em>all</em> browsers on iOS do NOT support the ability to render XML files. Instead you are required to download the feeds as static files to your system. Major bummmer. Hopefully this will be fixed in the near future.</p> +<h2>The Code</h2> +<p>Rendering your entry links as interactive URLs is fairly intuitive. You just need to:</p> +<ol> +<li>Tell the file which tag it needs to render as the "a:link" element</li> +<li>Set the inner child attribute to "href"</li> +<li>Set the value of that attribute to use the entry's <code>link</code> parameter</li> +</ol> +<pre><code><xsl:element name="a"> + <xsl:attribute name="href"> + <xsl:value-of select="link"/> + </xsl:attribute> + <pre><xsl:value-of select="title"/></pre> +</xsl:element> +</code></pre> +<p>In the instance above I am rendering the entry title as a clickable element which will direct users to the specific entry URL. You could simply render the full entry link URL text as the interactive link if you prefer. Something like:</p> +<pre><code><xsl:element name="a"> + <xsl:attribute name="href"> + <xsl:value-of select="link"/> + </xsl:attribute> + <pre><xsl:value-of select="link"/></pre> +</xsl:element> +</code></pre> +<h2>Live Example</h2> +<p>In a supported browser, you can see the code in action here: https://pblog.bt.ht/feed.xml</p> +<p>That's really all there is to it.</p> +<h2>Refs</h2> +<ol> +<li>https://shinobi.bt.ht/posts/patch-3.txt</li> +</ol> +<footer role="contentinfo"> + <h2>Menu Navigation</h2> + <ul id="menu"> + <li><a href="/">Home</a></li> + <li><a href="/projects">Projects</a></li> + <li><a href="/uses">Uses</a></li> + <li><a href="/wiki">Wiki</a></li> + <li><a href="/resume">Resume</a></li> + <li><a href="/colophon">Colophon</a></li> + <li><a href="/now">Now</a></li> + <li><a href="/donate">Donate</a></li> + <li><a href="/atom.xml">RSS</a></li> + <li><a href="#top">↑ Top of the page</a></li> + </ul> + <small> + Built with <a href="https://git.sr.ht/~bt/barf">barf</a>. <br> + Maintained with ♥ for the web. <br> + Proud supporter of <a href="https://usefathom.com/ref/DKHJVX">Fathom</a> & <a href="https://nextdns.io/?from=74d3p3h8">NextDNS</a>. <br> + The content for this site is <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>.<br> The <a href="https://git.sr.ht/~bt/bt.ht">code for this site</a> is <a href="https://git.sr.ht/~bt/bt.ht/tree/master/item/LICENSE">MIT</a>. + </small> +</footer>
\ No newline at end of file |