Improved Integration of Hugo and $\KaTeX$

Problem

There’s no custom $\KaTeX$ macro in local preview since I’ve merged some recent commits from the upstream of this blog’s theme, in particular, Beautiful Hugo’s pull requests #246 and #255, which allowed self-hosting the theme’s static JS, CSS and font files. This self-hosted option is particularly useful in case of slow response from Cloudflare’s CDN.

hugo local preview no KaTeX macro

public Hugo blog KaTeX auto-renderer error

Even they do appear on the public GitLab site, the final rendered Markdown + $\TeX$ code would be succumb to syntax errors due to their absence in the preview process.

[Read More]
KaTeX  Mmark  Hugo 

Replacing Deprecated Hugo Syntax in Blog Theme

Fixing Beautiful Hugo issue #261

Problem

Since the recent Hugo upgrade to v0.55.3, the following messages popped up after each local site regeneration with hugo server.

WARN 2019/04/24 18:07:00 Page's .URL is deprecated and will be removed in a futu
re release. Use .Permalink or .RelPermalink. If what you want is the front matte
r URL value, use .Params.url.
WARN 2019/04/24 18:07:00 Page's .Hugo is deprecated and will be removed in a fut
ure release. Use the global hugo function.
WARN 2019/04/24 18:07:00 Page's .RSSLink is deprecated and will be removed in a 
future release. Use the Output Format's link, e.g. something like: 
    {{ with .OutputFormats.Get "RSS" }}{{ .RelPermalink }}{{ end }}.
Total in 136 ms

GitLab’s online runner also gave the same type of warnings. This was reported in Beautiful Hugo issue #261.

[Read More]

Comparaison of Two Docker Images for Hugo

Having importing the repo for the Hugo theme Introduction from GitHub to GitLab, I added the automatically generated GitLab CI config file and I ran job #135854407.

$ cd exampleSite
$ hugo --themesDir=../.. -d ../public
hugo: /usr/lib/libstdc++.so.6: no version information available (required by hugo)
hugo: /usr/lib/libstdc++.so.6: no version information available (required by hugo)

The build succeeded with the above message. To suppress it, a switch to another CI runner will do. The associated GitLab CI config file was copied from Hugo’s documentation with some customizations for Hugo sample sites

[Read More]

Staticman Lab New Logos

StaticmanLab new logo

StaticmanLab's new logo

GitLab logo recreated from Wikimedia's logo by Darby under CC-BY-SA 4.0 and Staticman logo on GitHub by Erlen Masson under MIT.

The old icon for Staticman Lab was made by GIMP from Staticman’s icon in PNG in the GitHub repo. Recently, I’ve found the SVG version of this icon. To serve customers better, I’ve recreated the logo from this SVG file so that the edges in the logo become sharper.

[Read More]

Nested Comments in Beautiful Hugo

  1. A minimal demo site on GitLab (Source)
  2. Beautiful Hugo pull request 222
  3. Pre-release notes for this pull request

Motivation

For the mathematical ones, please see my previous post.

As a math student, it’s inefficient to reinvent the wheel like engineering students. Thanks to three existing examples, I had convinced myself that I could bring this to the theme Beautiful Hugo.

Interactive Blog on Static Web Host

Vision

  • gain autonomy: freedom is the basis of moral actions. No freedom, no morality.
  • transcend ourselves: change/improve our lives through free thoughts

Goal

Convert our free thoughts into free code.

Free code allows users around the world to run and/or improve them. This would bring real enhancement to our tools.

For example, beautiful math writing used to be a complicated process. A decade ago, this required the installation of a typesetting engine called $\LaTeX$. Thanks to freely available scripts like MathJax and $\KaTeX$, it’s now possible to write math viewable by any modern web browser by writing the content in the middle.

[Read More]

Custom $\KaTeX$ Macros

More efficient math editing

Background

Same as the last section in Beautiful Hugo Improvements.

Goal

To write math efficiently by automatically loading longer code with shorter macro code.

For example, when I wrote Some Infinite Cardinality Identities, it would be ten times more quicker and efficient to type \card{C} than to write \mathop{\mathrm{card}}(C) all the time.

Changes committed to my repo

The current version of Beautiful Hugo is still using $\KaTeX$ v0.7, which doesn’t support macros in auto-rendering. It would be inconvenient to include the macros after invoking $\KaTeX$’s render function.

[Read More]
Hugo  KaTeX  math 

Better Hugo ToC Fix

A JavaScript free way to improve default ToC

Background

I applied a fix to Hugo’s ToC ten days ago.

Drawbacks

To make the script non-render blocking, one has to place it in the footer. As a result, it takes about 0.2 seconds to remove the excess <ul> tag.

Solution

Thanks to Beej126’s Hugo template code, this site delivers table of contents processed by Hugo during GitLab’s continuous deployment.

Hugo 

Fix Hugo Table of Contents

Removal of wrapping HTML tag in JavaScript

Background (TL;DR)

While setting up the new version of Staticman for my demo GitLab pages, I’ve read developers’ documentations, setup guide and some community blog posts so as to come up with my own guide. It’s originated and inspired from a variety of sources, and refined according to hours of testing. Consequently, despite the original intention to keep things simple, I’ve finally come up with a post with over a thousand words.

To pass my ideas in this post to visitors, it’s better that they have an overview of the contents before actually looking into the details. Therefore, a table of contents is nice-to-have feature for this blog.

[Read More]

Beautiful Hugo Improvements

Some bug fixes, Font Awesome 5, and more ...

Fixed issue #142

Two weeks ago, Google Webmasters complained about the broken urls in this blog’s Tags page. This was reported by Joakim Vivas as issue #142 half a year ago. Pascal had submitted pull request #165 to fix this. However, he self-closed his PR.

Since the last commit by Michael Romero, Beautiful Hugo’s owner, was five months ago, it seems that he has abandonned his project. Therefore, I used Kaushal Modi’s solution to fix this at commit ff536782.

[Read More]
Hugo