I touched on nofollow for Hugo-sites recently, but thinking about it a bit more, I wonder if it needs some kinda of failsafe setup. What happens if Hugo stops injecting the link parser? What happens if I move to a different setup and forget the link processor? What happens if … (insert paranoia here)
The goal of nofollow links is to avoid having search engines use them, but still to allow users to use them. How might that be doable?
rel=nofollow has a number of usages.
One of the most common use-cases (I’m guessing) is to clarify that a link there because of an exchange of value - for example, it might be an ad, or it might be an affiliate link.
There are other use-cases, and other link-attributes, but I’m making too much of a fuss about this already, so I’ll leave it at rel=nofollow.)
There might be others, this is what I came up with.
- Write HTML. This is kinda straightforward.
<a href="https://example.com" rel="nofollow">anchor</a>, right?
- Append something to the end, eg
- Prepend something to block the links, eg
- Use a bounce URL, eg
Pros & amateurs
- Straightforward. It’s just HTML.
- It’s the well-defined implementation, with or without processing
- Gotta write clean HTML
- Reading posts is hard
- It’s no longer markdown, eh
Verdict: If all fails, use this.
Setup: append an annotation that doesn’t block the direct clicking of the URL, but which can be caught by a pre-processor and turned into a nofollow link. Use something like
# to avoid affecting the destination.
- Just works without processing
- Nofollow is dropped if processing fails
Verdict: Fine if you don’t strongly care about nofollow (if dropping a nofollow doesn’t bug you, should something fail). Not caring about nofollow seems to go against why I’m setting this up, so … meh.
Setup: Prepend an annotation that drops the link should processing fail. Use something like
# to break the link completely.
- Safe if processing fails
- Doesn’t work for users if processing fails
Verdict: Not having links work for users should processing fails seems annoying. Skip this.
Setup: Create a page that redirects to the destination. Block the bounce-URL with robots.txt. On the bounce-URL, recognize a parameter that points at the final URL and redirect as appropriate. Block the bounce URLs with robots.txt to prevent any crawling. Add a noindex, nofollow in case the robots.txt doesn’t get uploaded. Have the site-generator swap out the bounce-URL against a normal nofollow link.
- Kinda easy to use, just prepend the bounce URL to links.
- Don’t need to worry about the site generator forgetting to add
- Needs protection against abuse
- Uses code on the bounce URL + in the site generator.
- Overall most complex setup to create (robots.txt, bounce URL, link generator changes).
Verdict: Works for me. It’s implemented here.
If you’re messing with nofollow links on your site, make sure to add nofollow link highlighting to your browser, and add nofollow link-highlighting to your CSS.
- HTML links work, are easy to keep, but writing HTML for every link is so archaic.
- Appending something works, is pretty easy to code, but not Swiss-Bank-safe.
- Prepending something is too flakey.
- Bounce-pads are complex, but they work.
Which one to pick? Up to you.
Comments / questions
There's currently no commenting functionality here. If you'd like to comment, please use Twitter and @me there. Thanks!