Photo by Possessed Photography / Unsplash

Backlinks

Mar 24, 2022 (Mar 24, 2022) Loading...

I wrote a dinky thing for this site.

We're on Ghost, here. Ghost serves content. In this page of content. served by Ghost, there's a button. hit the button to see all the pages which link here.

What's happening? The button runs some JavaScript. That code flips open Ghost's public API (with a public key, there in the JS for all to see), and grabs all the content for the site, as HTML.

For each unit of content (a post, in Ghost terms), the code parses out the <a>nchor tags, extracts the href attributes, interprests those link addresses as URLs, extracts the pathnames (the bit after the website address), strips any parameters just in case, and compares with the pathname of the address of this page. If it finds that one of the anchors links here, it keeps a note of the post.

When the code has a list of posts which point to here, it gloms up a table below the button, and inserts a reference to each of those posts.

Then it disables the button, because I'm not going to write another conditional to guess whether it's already run, and otherwise you get duplicate lists.

Why not run the code as Ghost builds the page? It's wasteful.

Why have it at all? Because I'm building a garden – and if a path leads somewhere, someone should be able to go the other way; from destination to source.

Perhaps, as the site grows, I'll need to filter the extraction of pages. Right now, though, it's the wasteful opposite of what I wanted to do with a static site, and I'm happier about that than I had imagined.

Ghost is a pain for links, compared with my go-to-thinking-and-gardening tool, Roam. I'm glad to have a half-arsed mostly-working hacked-together way to give you (and me) a more free way to navigate the ideas here.

Here's more about Why Backlinks are Important to Me.

Member reactions

Reactions are loading...

Sign in to leave reactions on posts

Comments

Sign in or become a Workroom Productions member to read and leave comments.

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.