Posts about: GitHub Pages

Automatically ranking popular posts with Matomo

If you’ve been to the start page of this site lately, you may have noticed the ~elis/popular-posts/ section. It lists the blog posts that people actually read, based on the last 90 days of traffic. It used to be something I updated by hand every now and then, but now it refreshes itself every Sunday night.

How the section works

The section is driven by a single front matter field, popularRank. Any blog post that sets it is listed on the start page, sorted by the rank:

Read On →

Computing contrast colors without dart-sass

Back in 2021 I wrote about dynamic CSS color themes with similar contrasts, where I used a SCSS function to automatically adjust colors to meet the WCAG 7:1 contrast ratio against both a light and a dark background. The idea was that you specify the intent — the hue you want — and the build system derives the actual color that achieves sufficient contrast.

That worked well, but it required dart-sass. Hugo’s built-in LibSass was removed in Hugo 0.128, leaving dart-sass as the only SCSS transpiler. Getting dart-sass into the Nix build required a symlinkJoin bundle that wrapped Hugo with dart-sass on its PATH — not terrible, but an extra moving part in both devshell.nix and packages/default.nix.

Read On →

Dynamic CSS color themes with similar contrasts

This blog is built with Emacs, SCSS using Nix and deployed as static files to GitHub Pages. This blog also has quite some colors due to the syntax highlighting for code that is performed using CSS rules on HTML classes.

So in total I have 15 different colors defined, in which four of them is background and foreground colors, two of them is related to link and visited link colors. Then I have nine colors remaining which are related to syntax highlighting of code.

Read On →