How to Hide the Author Name in the Beautifulhugo Theme

how to remove author name

On this site there is only one administrator, so going to the trouble of showing the author (Author name) has no meaning. Setting the Author field to display:none; with CSS might remove only the display, but since it is unnecessary I thought I might as well delete it outright. Looking into the files right away, I found it written in theme/beautifulhugo/layouts/partials/post_meta.html. Copy {{ if not .Site.Params.hideAuthor }} {{ if .Params.author }} &nbsp;|&nbsp;<i class="fas fa-user"></i>&nbsp;{{ .Params.author | safeHTML }} {{ else }} &nbsp;|&nbsp;<i class="fas fa-user"></i>&nbsp;{{ .Site.Author.name | safeHTML }} {{ end }} {{ end }} Usually I would delete the relevant part and bring it over to root/layouts/partials/post_meta.html, but looking closely, the condition is the truth value of hideAuthor. [Read More]
Categories: hugo  Tags: beautifulhugo theme 

Creating Password-Protected ZIP Files on Linux and macOS

Creating a password-protected zip, and adding a password to an existing zip file

The other day, while self-hosting Bitwarden with Docker , I realised that leaving the data exported from LastPass and 1Password lying around as it is would be dangerous. Deleting it once it is no longer needed is probably the best answer, but I wanted to keep it as a backup, so I decided to save it as a password-protected zip. Creating a password-protected zip When you want to create a password-protected zip from a file Copy $ zip -e sample.zip sample.txt Enter password:<enter the password> Verify password:<enter the password> adding: test (stored 0%) When you want to create a password-protected zip from a directory When a directory is involved you need to be careful, because if you forget the -r option you end up with an empty zip file [Read More]
Categories: security  Tags: linux mac 

Running Dnsmasq in Docker as an Internal DNS Server for a Home LAN

Resolving my own domain inside the LAN with dnsmasq on Docker

On my home server I use my own domain and run several servers on it, but from inside the home LAN the traffic goes through the router, so accessing them with my own domain does not reach the servers inside the house It is easier to understand if you refer to this article When you only have a few PCs and devices, you can write the entries in each hosts file instead of introducing dnsmasq, but I also wanted to manage the hosts file in one place, so I built dnsmasq as a DNS server inside the LAN with Docker [Read More]
Categories: docker  Tags: dns 

Self-Hosting Bitwarden with Docker as a LastPass Replacement

Migrating from LastPass to Bitwarden

Since the free version of LastPass gets a device limit from the middle of March, I wanted to move away from LastPass sooner rather than later, so I looked into whether there was any open source password manager out there, and Bitwarden looked good, so — as always — I tried self-hosting it with Docker. What I do for the work is almost the same as the article below ↓ Bitwarden Here is the official site. If you are not going to self-host, it is easier to create an account and use that [Read More]
Categories: security  Tags: docker 

How to Find the Subnet Range of an ISP with whois

Usable not only for ISPs but for any organisation

There are times when you want to know the subnet range of an ISP or similar. For example, when you want to allow SSH only from your home subnet on an external server such as AWS or a VPS, and therefore want to know the range of the dynamic IP in your home environment. You can look it up with whois, which is a surprisingly simple method (well, the web based JPNIC WHOIS Gateway (in Japanese) is simple too…) [Read More]
Categories: security  Tags: network 

Fixing Hugo Source Build Errors on CentOS 7

Working around the errors that appear when building hugo from source

I posted a similar article before in GCC error with hugo on CentOS7 , but recently the build from source failed, so I worked on it. Incidentally, the version of hugo I am trying to build is 0.82 Environment Copy # cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core) # git version git version 1.8.3.1 # go version go version go1.15.5 linux/amd64 Building hugo from source Copy $ vim from-gh.sh mkdir $HOME/src cd $HOME/src git clone https://github.com/gohugoio/hugo.git cd hugo go install --tags extended $ sh from-gh.sh Error Copy Cloning into 'hugo'... remote: Enumerating objects: 50309, done. remote: Total 50309 (delta 0), reused 0 (delta 0), pack-reused 50309 Receiving objects: 100% (50309/50309), 93.65 MiB | 9.80 MiB/s, done. Resolving deltas: 100% (34542/34542), done. go: github.com/sanity-io/[email protected] requires github.com/pmezard/[email protected]: invalid version: git fetch --unshallow -f origin in /root/go/pkg/mod/cache/vcs/b66720d7c9f6776b1690ab6c7de6bd08fe64d74a3eaff8dbdef6603dac225370: exit status 128: fatal: git fetch-pack: expected shallow list When I updated git to the latest version, this time I got the error below [Read More]
Categories: hugo  Tags: centos 

Customizing image and link output with Hugo Render hooks

Render Hooks allow custom templates to override markdown rendering functionality

To insert an image in Hugo you write the standard Markdown ![Text](Link-URL), which renders as <img src "~">, but I had been wanting to build native lazy-load into the img tag. Incidentally, native lazy-load means that You can configure lazy loading of images easily just by adding the HTML loading attribute, without needing Javascript At first I thought it could only be inserted by using the figure tag or a shortcut and went through some trial and error, but when I looked into it I learned that it becomes possible by using Hugo’s Render hooks. If you want to know Render hooks in detail, see the official documentation. [Read More]
Categories: Hugo 

Beautifulhugo Stops Showing the Last Modified Date on Hugo 0.76 and Later

Failed to get translated string for language "ja" and ID "lastModified": template: :1:22: executing "" at <.Count>: can't evaluate field Count in type string

Beautifulhugo is the Hugo theme I still use today, and a symptom where the last modified date was not displayed showed up, so I dealt with it Incidentally, the hugo version is 0.80.0 Symptoms When I start the server locally, the last modified date is not displayed and the error below appears Copy $ hugo server -D .... Failed to get translated string for language "ja" and ID "lastModified": template: :1:22: executing "" at <.Count>: can't evaluate field Count in type string Since I deploy with Netlify, raising the hugo version in netlify.toml produces the same symptom Copy ... [context.production.environment] HUGO_VERSION = "0.80.0" HUGO_ENV = "production" HUGO_ENABLEGITINFO = "true" Cause Looking at the error message, the <.Count> notation seems to be the problem, and it is used in en.yaml, ja.yaml and the like inside beautifulhugo/i18n/. [Read More]
Categories: hugo  Tags: theme beautifulhugo 

Instagram Embeds Broke My Hugo Build After the oEmbed API Shutdown

Failed to retrieve remote file: Bad Request

Recently, after fixing Hugo settings or creating and editing articles, the build started failing and I could no longer update the site. Symptoms Failed to get JSON resource “https://api.instagram.com/oembed/?url=https://www.instagram.com/p/BGvuInxxxx/&maxwidth=640&omitscript=true" : Failed to retrieve remote file: Bad Request Looking at the deploy log, Failed was displayed at the Instagram API part and the build was being aborted. It seems that in Hugo, when an instagram shortcode is inserted, the build now fails. [Read More]
Categories: Hugo  Tags: Instagram api 

Why Scripts in /etc/cron.weekly Do Not Run on Debian

Scripts placed in /etc/cron.weekly on Debian do not run

Running on debian10(Buster), I had placed a backup script (backup.sh) under /etc/cron.weekly/, but apparently it was not running. Of course I had given it execute permission, and I had confirmed it works when run manually. Checking my other machines, it turned out that it works without any problem on CentOS while none of them run on Debian. Looking into it, according to run-parts(8), it seems that extensions containing a dot, such as .sh or .pl, do not run [Read More]
Categories: linux  Tags: debian ubuntu