Earth Notes: On Website Technicals (2018/12)

Tech updates: feeds and buttons, IMG helpful for normal pages not just AMP, IMG from CMS, test cases...

2018/12/09: Random Page Build Order

At times there may be more than one make running to try to rebuild EOU. For example, while the battery charge is high a make -k all may be run every hour.

In particular, the rebuild of each page has a lock around it. Two or more make processes may end up continually trying to make the same page next, with one of them being excluded by the lock after a timeout, and moving on. The multiple processes tend to stay in lockstep, and all that lock contention wastes time and reduces parallelism.

In general make tries to be reasonably dependable and consistent, and shaking that up is hard. A reasonable solution for my gmake on *nx is, given my list of main pages in a "simply expanded variable" PAGES:

PAGES := pageA.html pageB.html ... another.html

... and given that each page's build is independent of the others, then adding this line afterwards mixes things up:

PAGES := $(shell echo $(PAGES) | xargs -n1 | sort -R | xargs)

This works fine with independent make runs with ot without -j to add paralllelism.

The cost is a the execution of the shell command once per make invokation.

2018/12/07: IMG Test Cases

It's a day off for me today, so of course what I do before breakfast is add a couple of tricky unit test cases for IMG!

Let joy be unconfined!

I'm modifiying IMG to be able to accept as src a (standard) thumbnail URL in my 'CMS', at least for body images in the first instance.

This means that I need not copy, minify and check-in to the VCS body images for EOU if they are already being hosted in the Gallery.

(This also means that the IMG tag remains valid HTML if not translated, even if it will be non-optimal in a number of ways.)

The appropriately scaled images will still be served from directly under /img/a/ rather than by the Gallery, and clicking the image will take the visitor through to the Gallery catalogue page.

solar PV grid tie roof mounted power system on slate roof on outbuilding shed garage 1 DHD

Which means that I can drop almost any still raster image in, on whim!

2018/12/02: IMG Helps

The IMG tag is helping me to spruce up existing pages, eg in adding new images to them. Even if I never take AMP pages live, the mechanism is useful. It helps to only need src and class attributes. It is proving helpful to be able to manually set alt sometimes.

So, for example, On Greening Christmas had its rather poor lone image improved and a new one added, and that second image was also added to Low Carbon Family Holidays. I automatically get smaller lower-weight versions for the mobile pages, along with really-low-weight Save-Data versions, and a link back to the source image if too large to be used directly, so possibly containing other information of interest to the visitor. What's not to like?

2018/12/01: Atom Feeds

I freed up a little space on the CRP (Critical Rendering Path) for the home pages (desktop and mobile) and so inserted a header link to the basic Atom site feed. My Firefox "Brief" plugin picks that up and shows a feed button in the URL bar, and I'm hoping that other browsers give similar signals.

Soon I shall drop both the RSS/Atom and G+ 'social media' buttons for each page, and so keeping the feed on the home page in this way may be useful.