Sunday 9 June 2024 Migrated links data to recutils =============================== Yesterday I wrote that I am going to shutdown my Linkding bookmark manager [1]. I use Linkding not only to manage my bookmarks, but also to collect web pages for my links page [2]. In Linkding, I use a special tag to identify the web pages that will be included on the links page. Linkding API ------------ Up until now, the links page is build by the same home-grown SBCL program that builds my web site. To build the links page, it uses the Linkding API to get the data for it. It queries for the specific tag to get the right bookmarks. Export to GNU recutils recfile ------------------------------ Today, I added a temporary function to the SBCL program that exports the data for the links page. It creates a GNU recutils recfile, containing the category, URL and the title for each web page. The GNU recutils tools are specially created for human-editable, text-based databases [3]. When a bookmark is added to Linkding, Linkding fetches the title of the page. Because of this, some links in the link page got a label like "Home | ", or "Blog | ". I used the opportunity to go manually through the recfile and made some edits. Small shell script ------------------ I wrote a recfmt file and a small shell script. For each category, the shell script queries the recfile, assemble the links with recfmt, and sort the links. The result is a file with the contents of the links page. I also modified the SBCL program. To build the links HTML-file, it no longer calls the Linkding API, but simply reads the content from the file, that is created by the new shell script. Maintenance of the links . -------------------------- From now on, the recfile is used for the maintenance of the links. To add a web page to the links page, I will manually add it to the recfile. Or remove a web page from the links page by removing it from the recfile. Before running the SBCL program to update my website, the shell script is run again. This will query the recutils database and recreate the contents file for the links page. The SBCL program rebuilds all the files of the website, including the links page. Final step ---------- Now the creation of the links page has been migrated to a GNU recutils database, nothing stands in the way of shutting down the bookmark manager. Which still is scary :) [1]: gopher://box.matto.nl/0/bookmark-manager-the-siren-call-of-web-browsing.txt [2]: http://box.matto.nl/links.html [3]: https://www.gnu.org/software/recutils/manual/html_node/Purpose.html Last edited: $Date: 2024/06/09 15:55:52 $