Currently, Hugo 0.146 is incompatible and the theme hasn't been updated to it, so install 0.145:
HUGO_VERSION=0.145.0
curl -L -o /tmp/hugo.tar.gz \
"https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz"
tar -xzf /tmp/hugo.tar.gz -C /tmp hugo
install -m 755 /tmp/hugo "$HOME/.local/bin/hugo"
hugo versionNote: Install Hugo in linux or wsl using snap (don't use anything else because they have old versions).
hugo new site shital
cd shitalshah.com-v
git init
# see https://stackoverflow.com/a/79408066/207661
git submodule add -b stable https://github.com/sytelus/congo.git themes/congo- All of the *.toml from theme's
config/_defaultis copied toconfig/_defaultand customized. - The
config.tomis added with custom paramparams.siteverto save site version. - The
layouts/partialsin site directory overrides files in theme'slayoutsfolder. Currently, onlyfooter.htmlis the override and only change in there is to add copyright year and sitever. Iffooter.htmlchanges in original theme then we need to sync override file. - The
assets/css/custom.cssadded to increase font size. - The
static/_headersis added to allow cross domain call toindex.jsonso that search works when calling fromwww.domain.cominstead ofdomain.com.
Comments are powered by Giscus, which uses GitHub Discussions as the backend. Comments are stored in the sytelus/shitalshah.com-comments repository.
Key files:
layouts/partials/comments.html- Contains the Giscus embed script and exclusion logiclayouts/_default/single.html- Controls where comments appear in the page layout (after content, before sharing links)config/_default/params.toml- GlobalshowCommentssetting under[article]
Configuration:
- Comments are enabled globally via
showComments = trueinparams.toml - Comments are automatically hidden for:
- Draft posts (
draft: truein front matter) - Private posts (
private: truein front matter) - Posts in the
tweet/subfolder
- Draft posts (
- Per-post override: Add
showComments: falsein front matter to disable for a specific post - Theme follows system dark/light mode via
data-theme="preferred_color_scheme"
To modify Giscus settings:
- Visit giscus.app to generate new configuration
- Update the script in
layouts/partials/comments.html
Content goes in content/blog/.
For posts with images/files,
- Create a folder with the same name as file without extension in one of the below approaches.
- Move
.mdfile in the folder and rename it toindex.md. - Put all images/files in the post folder.
Run the command:
hugo new content blog/my-new-post.mdThis will create file my-new-post.md in folder content/blog. Append YYYY-MM-dd- to file name for consistency.
Create .md file and use markdowndown format (sample, sample markdown). Note that the start of the markdown is called front matter where all the post metadata goes. You can copy initial content from archetypes/blog.md template.
To insert figures, charts etc:
{{< figure src="festivities.svg" class="m-auto mt-6 max-w-prose" >}}To insert image:
To insert tweet:
{{< tweet user="sytelus" id="1714557767250489783" >}}To add url,
<https://some.url>To add YouTube:
{{< youtube ZJthWmvUzzc >}}See if submodule has new commits:
git submodule statusUpdate the submodules:
# from repo root folder
git submodule update --remote
git add themes/congo
git commit -m "Updated theme"
git push origin masterReference:
-
Make changes in content directory by adding/updating md file(s).
-
Run
./view.shto preview the changes. You can additionally pass-D --watch --poll 10000 --disableFastRender. This will show draft changes due to-Dswitch which won't be published and suppress i18n warnings if any. The--pollis only needed if working on/mntin WSL. Most of the time--disableFastRenderis not really needed. -
If everything looks good, run
./deploy.shcommand which will generate static pages in public folder which is already mapped to GitHub Pages repo. -
Commit and push the changes in
publicand then in main repo:# switch to public pushd public git add . git commit -m "deployment" git push # back to main popd git add . git commit -m "deployment" git push
References:
- Enable tags in menu
- Fix page content links, images
- Move twitter posts
- Restore from archived posts