The riddle of the NetNewsWire visited link
- Posted
21 June 2025
Past me is a fool. He spent a portion of my limited lifetime supply of keypresses on the colour choice of visited links in a NetNewsWire theme.
In case you haven’t caught on (I forgive us), NetNewsWire is not a browser. It displays some HTML in a web view. This content, extracted from an XML file, usually includes links. Links are <a>
elements with a :visited
state. Logical right? Not quite. It didn’t cross the code-addled mind of past me that NetNewsWire never visits web pages. How do you get a visited link without the visit!
The thing is… I was seeing visited links in NetNewsWire. I was styling visited links. Definitely visited. In the colour I assigned to a:visited
. In the theme I had installed. But how? What is going on?
To avoid unnecessary embarrassment I won’t mention some of the (fortunately shallow) irrational rabbit holes I looked in first. The important clue was where the visited links were appearing. Only in some feeds, and only adorning the feed link title.
This is the bit where I plug the Template variable NetNewsWire theme. Necessary because NetNewsWire does not have dev tools enabled in it’s web view (I remember the web before Firebug – it was not pretty). Anyway…
Turns out, the feeds displaying the :visited feed link title. Did not have a feed link.
Of course there was a link! I can see it. If I click it, my browser opens the blog post on the web. That is confusing. I know. I was confused too, for a moment at least. I’ll try to explain because when I understood I laughed.
This is the pertinent portion of template before NetNewsWire renders the page:
<a href="[[feed_link]]">[[feed_link_title]]</a>
NetNewsWire, to render a feed item, replaces tokens in the template. A feed item with no feed link might result in this perfectly valid link.
<a href="">A curiously visited link</a>
Here it is rendered in this page: A curiously visited link. Give it a click. You’ll find it reloads the page, because it is a link to the current page.
Which of course you’ve visited. As a matter of fact, you’re there right now.
But, but, that’s not what happens when I click the “visited” links in NetNewsWire. It loads the feed item’s page on the web, past me might have said.
This is explained by the presence of a base tag in the template in which the link is rendered.
The base URL to be used throughout the document for relative URLs.
NetNewsWire assigns the feed item’s “preferred link” to this URL. As a result, empty links, relative to the base link, effectively become the base link. That is, a link to the blog post NetNewsWire has rendered.
Now I know what’s going on, I’ll line up a change to Scratch to display feed items without feed links a little differently.