A collection of tech notes, personal reflections, and evolving thoughts about whatever’s caught my curiosity.

notes

Slash pages in Hugo

16 October 2024

In Hugo, creating different slash pages (like /about/, /uses/, etc.) involves creating specific content files for each page and customizing templates as needed.

  • Create individual markdown files for each slash page under content/.
    If you want to create an /about/ page in your blog, add a markdown page with below front matter in the content/ page.
//content/about.md
---
title: "About"
date: 2024-10-16
---

This is the About page content.
  • Optionally create a template for the page.
    Hugo uses the single.html template from the layouts/_default/ folder to render pages by default. However, you can create custom templates in the layouts/page/ folder to format specific pages as needed.
//layouts/page/about.html

<h1>{{ .Title }}</h1>
<div class="content">
  {{ .Content }}
</div>

You can check my slash pages like uses, credits, and changelog.

References

Hugo Docs

notes

Hugo Troubleshooting

14 October 2024

Hugo is fast, but ineffecinet templates can make it slower. For checking the performance you can use the below commands.

  • Use hugo --logLevel debug to display debug information, warning, and error message.

  • Use hugo --templateMetrics to check for slow templates. This will show the time it takes to render each template.

  • Use hugo --gc (garbage collection) to clean up unused files, which might help reduce build time.

  • Use debug.Timer to determine the execution time of a block of code. And use the hugo --logLevel info info command line flag when you build the site.

{{ $t := debug.Timer "TestSqrt" }}
{{ range seq 2000 }}
  {{ $f := math.Sqrt . }}
{{ end }}
{{ $t.Stop }}
References

Hugo Docs

notes

Walking

14 October 2024

Walking brings clarity to your thoughts.

essay

About this digital garden

8 October 2024
This website is where I document and share pieces of my life my thoughts, photos, code snippets, and notes collected along the way...
notes

Answers

7 October 2024

Create your own answers.

notes

Write it down

5 October 2024

By writing down your problems, you’ll be able to see the solutions clearly.

essay

Understanding useRef

2 October 2024
useRef is a powerful React Hook that allows you to create and manage mutable references that persist between renders, Unlike state, changing the value of a useRef object does not trigger a re-render...
essay

പ്രകാശഗോപുരങ്ങൾ

23 September 2024
മനോഹരമായ വൈകുന്നേരമൊരു കവിതയെഴുതിയാലോന്ന് തോന്നി. ഓർമ്മകളുടെ മഴപെയ്ത്തിൽ സദാ നനഞ്ഞ് നിൽക്കുന്നത് കൊണ്ട് നിങ്ങളെക്കുറിച്ച് എഴുതാമെന്നു കരുതി.
notes

ഭ്രമണം

13 September 2024

പ്രകാശത്തിന്റെ പകലിൽ
മഞ്ഞവെളിച്ചങ്ങളുടെ ഇരുട്ടിൽ
ഓർമ്മകളുടെ പെയ്ത്തിൽ
നിശ്വാസങ്ങളുടെ ഇടന്നേരങ്ങളിൽ

നിങ്ങളിലാണ് ഞാൻ
ഭ്രമണം ചെയ്യുന്നത്.