Install

brew install hugo
hugo new site spacedust --format yaml
cd spacedust
git init
git submodule add --depth=1 https://github.com/adityatelange/hugo-PaperMod.git themes/PaperMod 

# clone your repository with its submodule
git clone --recurse-submodules ${repository}

# initialize and update submodules (if you cloned it without submodules)
git submodule update --init 

Repository

Git repository mupofps/hugo-spacedust in Gare.

Archetypes

archetypes/default.md with YAML front matter from Hugo.

---
date: '{{ .Date }}'
draft: true
title: '{{ replace .File.ContentBaseName `-` ` ` | title }}'
tags: ['{{ replace .File.ContentBaseName `-` ` ` }}']
---

Home

hugo.yaml

params:
  homeInfoParams:
    Title: "Hello ๐Ÿ‘‹ "
    Content: | 
      ![Home Image](/home-image.jpg)   
      Welcome to "Space Dust"!    
      There is the blog of Mu Jiang. 

assets/css/extended/custom.css

img[alt='Home Image'] {
    max-width: 100%;
    border-radius: var(--radius);
    margin: 0px 0px 0px 0px;
}

CLI

pass environment variables

env HUGO_TITLE="Some Title" hugo

show drafts

hugo server --bind "$interface_ip" -b "$url" -D

build the site

hugo -b "$url"

watch for changes

hugo -b "$url" -w

clear obsolete files

hugo -b "$url" --cleanDestinationDir

Access Key

Check Wikipedia and PaperMod.

c - ToC Open/Close
g - Go To Top
h - Home (according to current lang)
t - Theme toggle
/ - Jumps to search page if in menu

Modifier on Windows, FreeBSD, and Linux (Chrome): Alt or Alt + Shift 
Modifier on macOS (Safari or Chrome): control + option 

Mathematics

Add these two files to layouts/partials/.

โ”œโ”€โ”€ layouts
โ”‚ย ย  โ””โ”€โ”€ partials
โ”‚ย ย      โ”œโ”€โ”€ extend_head.html
โ”‚ย ย      โ””โ”€โ”€ math.html

extend_head.html form PaperMod

{{ if or .Params.math .Site.Params.math }}
{{ partial "math.html" . }}
{{ end }}

math.html form Katex

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-n8MVd4RsNIU0tAv4ct0nTaAbDJwPJzDEaqSD1odI+WdtXRGWt2kTvGFasHpSy3SV" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-XjKyOOlGwcjNTAIQHIpgOno0Hl1YQqzUOEleOLALmuqehneUG+vnGctmUb0ZY0l8" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"
    onload="renderMathInElement(document.body);"></script>

Examples:

  1. Inline type \( \beta = \alpha -\gamma \)
  2. Block type $$ \varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } } $$

Share Icons

Add more share icons which is modified by Inkscape. Check share_icons.html for details.

Social Media

More social media icons: weibo, qq, qzone, douban. The icons are from Simple Icons.

Copy to Clipboard

Click clipboard icon to copy the post url. The icons are from Feather.

QR Code

Click QR code icon to go to the qrcode page.

  • The icon is generated with text “QR” by qrcode-svg.
  • The QR code generator static/qrcodejs/qrcode.min.js is from davidshimjs / qrcodejs.
  • The qrcode page use the query string ?text=* to get contents. Check its layout qrcode.html for details.

P.S.

The icon of Space Dust is form MDI project and the home image of it is from Unsplash.