aboutsummaryrefslogtreecommitdiff
path: root/build/posts/rss-click/index.html
blob: dd0ab2413ddb70fe8f5491dd9b0d027699559566 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!doctype html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="color-scheme" content="dark light">
	<link rel="icon" href="data:,">
	<title>Clickable Links Inside XML</title>
	<link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" />
	<link href="/rss.xml" type="application/rss+xml" rel="alternate" title="RSS feed for blog posts" />
<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}blockquote{background:rgba(0,0,0,0.1);border-left:4px solid;padding-left:5px;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style>
</head>

<nav>
	<a href="#menu">Menu &darr;</a>
</nav>

<main>
<h1 id="clickable-links-inside-xml">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 id="the-code">The Code</h2>
<p>Rendering your entry links as interactive URLs is fairly intuitive. You just need to:</p>
<ol>
<li><p>Tell the file which tag it needs to render as the &#8220;a:link&#8221; element</p></li>
<li><p>Set the inner child attribute to &#8220;href&#8221;</p></li>
<li><p>Set the value of that attribute to use the entry&#8217;s <code>link</code> parameter</p>
<p><a href="/xsl:attribute">&#47;xsl:attribute</a>
    
<a href="/xsl:element">&#47;xsl:element</a></p></li>
</ol>
<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>&#60;xsl:element name="a"&#62;
    &#60;xsl:attribute name="href"&#62;
        &#60;xsl:value-of select="link"&#47;&#62;
    &#60;&#47;xsl:attribute&#62;
    &#60;pre&#62;&#60;xsl:value-of select="link"&#47;&#62;&#60;&#47;pre&#62;
&#60;&#47;xsl:element&#62;
</code></pre>
<h2 id="live-example">Live Example</h2>
<p>In a supported browser, you can see the code in action here: <a href="https://pblog.bt.ht/feed.xml">https:&#47;&#47;pblog.bt.ht&#47;feed.xml</a></p>
<p>That&#8217;s really all there is to it.</p>
<h2 id="refs">Refs</h2>
<ol>
<li><a href="https://shinobi.bt.ht/posts/patch-3.txt">https:&#47;&#47;shinobi.bt.ht&#47;posts&#47;patch-3.txt</a></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">&uarr; 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> &amp; <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>