PeterSmith.Org

Hugo directory structure


When I started to dabble with Webmentions I first created a new type of content called likes. This basically entailed me making a directory in my content directory called likes anb putting my 'likes' in there. That also meant I had to create some new templates in my theme directory:

  • layouts/likes/single.html
  • layouts/likes/list/.html

The I made a new type of webmention response called replies.

That entailed another new directory in my content directory, and single and list templates.

Full entry …

Caran d'Ache 849


I went back into the office last Tuesday, and sitting on my desk was my trusty TWSBI 580, still full of ink. I've not been in the office for more than 5 months, and the pen had just been sitting there. When I went to use it the cap broke. Stewth! A quick Google search showed that Inkt in Whanganui had replacement caps. As I was browsing their website, I noticed that they had Caran d'Ache 849 pens, and thought "why not". The range of available colours was somewhat limited; many of what I would expect to be popular colours were out of stock. So, I opted for an orange fluro body with a fine nib (surprise, surprise). I also ordered a converter so I can use bottled ink rather than cartridges. Despite them shipping it the same day, there were some delays with NZ Post, but eventually it turned up.

Full entry …

Hugo and JSON


Diving into IndieWeb (in general) and into to webmention's 'likes' (in particular), I have had to get to grips with how to work with JSON under Hugo.

Having restructured my content layout on disk, I turned my attention to what to do with the webmentions.json file that I downloaded from webmention.io using webmention.io-backup. Originally, I had been downloading a single monolithic file with all the responses folk had done to my website. I put the file in my Data directory and accessed from within Hugo using data templates.

All well and good. But one of the great thing about Evgeny's tool is that it can store the response from webmention.io into the directory of the relevant page bundle. So, I tweaked the script I used to call webmention.io-backup to look like this.


#!/bin/sh

FILENAME="responses.json"

webmention.io-backup -t ${WEBMENTION_KEY=} -d petersmith.org -cd content -f ${FILENAME}  -jf2 -tlo=false -p -ts

#
# Now fix the pesy hypens in the poperty names
#
find . -name ${FILENAME} -exec sed -i  '
s/\(^ *\)"like-of":/\1"like_of":/
s/\(^ *\)"mention-of":/\1"mention_of":/
s/\(^ *\)"in-reply-to":/\1"in_reply_to":/
s/\(^ *\)"wm-/\1"wm_/' {} \;
Full entry …

Content structure


Following on the comments from Evgeny to my post, I have changed the directory structure for my posts.

Up until now, I had a directory blog which was full of directories, such 20220112-content-structure, where the first six digits represented the date. In that directory I then had an index.org file with the content of my post.

Now I have moved to a hierarchical date structure, where the content for that post is now in blog/2022/01/12/content-structure/index.org. I wrote a quick and dirty shell script to move all the posts.

Full entry …

In reply to:


https://evgenykuznetsov.org/en/reactions/2022/re-010174726/

Evgeny, yes, I thought that would be the problem. I have been using permalinks like that ever since I started using Hugo back in 2016. It's messier than it might first appear, because as you can see from this 'snip' of my config.toml only some content is laid out that way.


[permalinks]
    blog = "/blog/:year/:month/:day/:slug/"
    notes = "/notes/:year/:month:/:day/:slug/"
    mentions = "/mentions/:year/:month:/:day/:slug/"
    resources = "/resources/:slug/"
    pages = "/pages/:slug/"

I suppose, it would be easy enough for me, bash, and sed to move to a directory structure like yours (fixing up any relref on the way). Then, the structure 'on-disk' of all my content would be consistent across all the sections (blog, notes, mentions, etc.) with how it is presented on the web.

Full details …

In reply to:


https://evgenykuznetsov.org/en/reactions/2022/re-010053443/

Oh joy. I got a response from Evgeny. Now I need to sort out my workflow for responding to responses.

To answer your questions, my directory structure is using page bundeles with each section (blog, notes, pages, etc) having all my posts, like this:


  petersmith.org
          archetypes
          config.toml
          content
             blog
               ...
               ...
               20041208-anzam-strategising-activity-and-practice
                   index.org
               20041208-professional-doctorates
                   index.org
               20041209-comments-on-supervision
                   index.org
               20041210-teaching-excellence-award
                   index.org
               20110227-yale-on-writing
                   index.org
               20110303-boots-and-all
                   index.org
               20110305-how-to-write-an-article
                   index.org
               20110305-the-paragraph
                   index.org
               20220104-responsive-grids
                   index.org
               20220106-second-second-steps-in-indieweb
                   index.org
               20220110-third-steps-to-indieweb
                   index.org
             mentions
             notes
             pages
             resources
          data
             mentions.json
          i18n
          layouts
          public
          resources
          static
          themes
Full details …