πŸ“’ Actions Speak Louder Than Words!

πŸ’Ό Status:
Indieweb and POSSE

Posted: Oct 15, 2021 | Reading time: 4 min
πŸ“’ I’ve moved to a new website. Please visit me at https://journal.robbi.my !
note
tl;dr: Publish Own and Syndicate Somewhere Else (POSSE)

Oh man, #indieweb are so exciting and fun to explore! Today, I want to update and share a few thing that might be useful to someone else out there. Hopefully this help you to adapt changes and reach your goals faster.

ToC

Storing webmention data

Currently all webmention data stored as JSON file on my repository, I not anymore bound to use client-side rendering via Javascript like my previous tutorial because everything now are static hosted inside my source code repository.

Simply wrote a python script to be executed during build process, then communicate with webmention.io API, convert the output as JSON file, add (commit) to repo and trigger a new CI/CD on Gitlab (so the next build will the latest changes happened on our branch).

pages:
  stage: deploy
  script:
    - hugo --verbose --minify --enableGitInfo
    - git clone git@gitlab.com:RobbiNespu/robbinespu.gitlab.io.git
    - cd robbinespu.gitlab.io
    - git checkout master
    - python3 ./get-mentions.py
    - git status --porcelain
    - |
        if [[ `git status --porcelain` ]]; then
        git add . &&
        git commit -m "✨Update webmention data" &&
        git push origin master -o ci.skip
        curl -X POST -F token=XX -F ref=master https://gitlab.com/api/v4/projects/YY/trigger/pipeline
        fi        
    - echo 'Build is complete...!'

Here the output during build process

$ hugo --verbose --minify --enableGitInfo
Start building sites … 
hugo v0.88.1-5BC54738 linux/amd64 BuildDate=2021-09-04T09:39:19Z VendorInfo=gohugoio
INFO 2021/10/15 09:41:36 syncing static files to /builds/RobbiNespu/robbinespu.gitlab.io/public/
ERROR 2021/10/15 09:41:36 Markup type mmark is deprecated and will be removed in Hugo 0.89.0. See https://gohugo.io//content-management/formats/#list-of-content-formats
                   |  EN   
-------------------+-------
  Pages            | 1278  
  Paginator pages  |    0  
  Non-page files   |    0  
  Static files     |  180  
  Processed images |    0  
  Aliases          |   94  
  Sitemaps         |    1  
  Cleaned          |    0  
Total in 6520 ms
$ git clone git@gitlab.com:RobbiNespu/robbinespu.gitlab.io.git
Cloning into 'robbinespu.gitlab.io'...
Warning: Permanently added the ECDSA host key for IP address '172.XX.YY.ZZ' to the list of known hosts.
$ cd robbinespu.gitlab.io
$ git checkout master
Already on 'master'
Your branch is up to date with 'origin/master'.
$ python3 ./get-mentions.py
URL https://robbinespu.gitlab.io/indieweb/211012114728/  --> md5: e10661eb009561bc4a7239162f4622af
.
.
.
$ git status --porcelain
 M data/webmentions/e10661eb009561bc4a7239162f4622af.json
 M data/webmentions/mentions.json
$ if [[ `git status --porcelain` ]]; then # collapsed multi-line command
[master a06b5c5] ✨Update webmention data / optimize images
 2 files changed, 19 insertions(+), 1 deletion(-)
To gitlab.com:RobbiNespu/robbinespu.gitlab.io.git
   5c7615b..a06b5c5  master -> master
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1355  100  1087  100   268   1764    435 --:--:-- --:--:-- --:--:--  2196

As you can see, I store the JSON response as a file which named by using MD5 hash inside data/webmentions/ directory. Now what we need just a partial template to load the webmention data on our page. I just took the renderer HTML of PlaidWeb/webmention.js as base.

permanent URL and aliases

Some important tips is to maintain your permanent URL link or use fixed URL for indieweb kind. As for me, I do a mistake using my own own slug (eg: /indieweb/2021-10-06-checkin-pasar-dungun/ ) but later on I decided to use timestamp (eg /indieweb/211006013518/) as my permanent URL. So it quite a waste if I discard the webmention data I received before, the solution are to apply aliases on them and loop alias (as slice) together with current URL and display the data.

{{ $dummyAlias := slice .RelPermalink }} <!-- add current URL -->
{{ range $.Page.Params.aliases}}
    {{ $dummyAlias = $dummyAlias | append . }}  <!-- add alias URL if exist -->
{{ end }}

{{- range $dummyAlias -}}
        {{ $aliases := printf "https://robbinespu.gitlab.io%v"  . }}
        {{ $aliasesMD5 := $aliases | md5 }}
        .
        .
{{- end -}}

Webmention and brid.gy auto publish

Incase you wondering what happen if I receive a new comment or reaction via webmention then let me tell you that I already setup webmention.io to send a web-hook to trigger the first Ci/CD build and as mentioned previously, the build will capture and store the latest webmention another second build to finalize everything.

For triggering sending webmention, I use Github action workflow to fetch recent RSS, grep the link and execute curl to https://webmention.app to check if the link have target or hidden link of https://brid.gy/publish/{twitter,mastodon,github} for auto publish.

The key is to split up work flow into 4 parts, check the repository for sample and more technical understanding.

The issue I have right now is to delete the indieweb post. On indieweb standard, the deleted post should return HTTP status with 410 Gone not 404 Not found. This is impossible for me because server side is controlled by Gitlab itself. As alternative, I tried put <meta http-equiv="Status" content="410 Gone" /> on HTML head but it not reflected even on indiweb.org website. Check deleted RSVP and a new RSVP seem both displayed on https://events.indieweb.org, this is not right and what I expected 🀷. I don’t think they can handle it correctly via meta but I guess it not important as long the origin source (my website) marked it deleted and I can send second post as appeal to change my RSVP status.


πŸ”€ Syndicated to: /

Edit

Have some thoughts, discussion or feedback on this post?
IndieWeb Interactions

Below you can find the interactions that this page has had using Indieweb. Which means, you can mentioned this URL on any website that support WebMention. Have you written a response to this post? Let me know the URL:

((Do you use a website that do not set up with WebMention capabilities? You can use Comment Parade.)