Learn how to work effectively with HBStack, including development workflows best practices, and common tasks for building and maintaining your site.
Learn how to work effectively with HBStack, including development workflows, best practices, and common tasks for building and maintaining your site.
localhost:1313 or any other port which would appear at / endpoints.ports:9000/ in the pricture shown below._index.md under content folder is the best choice.1---
2title: Projects Notes
3layout: landing
4#description: Personal project tracking and documentation
5---
landing layout, which is suitable for a home page.title and description fields can be customized to reflect the purpose of your home page.Important
it is the layout template defined in your website or a theme or a framework which renders the contents if there are any.
_index.md file shown below will not be rendered as a home page, because it does not have the layout: set.1---
2title: Projects Notes
3#layout:
4#description: Personal project tracking and documentation
5---
Caution
No Layouts template no Contents, Hbstack is built upon Hugo, and Hugo requires a layout to render the contents.
layouts folder.layouts folder contains templates that define how the content is displayed. The convention is to have a _default folder under layouts which contains the single.html and list.html files and may be other files as well.layout field is not set to landing or not defined to point to any other layout, no contents will be rendered on the home page unless it is defined by the type field in the front matter of the _index.md file.type or layout is not set, the page or a home page either will not be rendered or will be rendered according to section where it is placed._index.md file is placed under content/docs/, it will be rendered as a documentation page using the docs layout, and if it is placed under content/blog/, it will be rendered as a blog page.layouts folder or the user who is importing the modules but remains in the cache.cache folder is where the templates are stored after they are compiled by Hugo. This is done to improve performance and reduce the size of the final site.config.yaml file or in the param.yaml file.layout is set to landing. And by default the header and footer are shown.Note
Following picture shows the header and footer on the home page with the landing layout. The same layout will be used if you set the layout to be
listinstead oflanding.
type Frontmatter VariableThe type frontmatter variable is a fundamental concept in Hugo that controls template selection and content organization. Here’s a comprehensive explanation based on Hugo’s documentation and HBStack usage patterns:
type in Hugo?According to Hugo’s official documentation, the type variable determines which template directory Hugo looks in when rendering a page. From the Hugo Template Lookup Order documentation:
Type Is value of
typeif set in front matter, else it is the name of the root section (e.g. “blog”). It will always have a value, so if not set, the value is “page”.
type Workstype: docs in frontmatter, Hugo looks for templates in /layouts/docs/type is specified, Hugo uses the top-level directory name (e.g., content in /content/blog/ gets type: blog)/content/ directory, the default type is pageBased on exploration of your Hugo modules cache, HBStack provides these specific content types:
type: blog/layouts/blog/single.html, /layouts/blog/list.htmlhbstack/blog@v0.42.1type: docs/layouts/docs/single.html, /layouts/docs/list.htmlhbstack/docs@v0.24.0type: gallery/layouts/gallery/single.html, /layouts/gallery/list.htmlhbstack/gallery@v0.13.1type: archives/layouts/archives/type: authors/layouts/authors/The type template is usually present in archetype files, my site has these types available:
1/archetypes/blog.md # type: blog (auto-detected)
2/archetypes/docs.md # type: docs (auto-detected)
3/archetypes/gallery.md # type: gallery (auto-detected)
4/archetypes/projects.md # type: projects (custom)
5/archetypes/tutorials.md # type: tutorials (custom)
6/archetypes/docs-with-faq.md # type: docs with FAQ extension
Note
Not all types present in archetypes define layouts but they can be used to create content with specific types.
When you create a new content based on these archetype, use --kind flag to specify the type:
1hugo new posts/my-first-post.md
2hugo new --kind docs <file-path>
Here’s how Hugo finds templates based on type:
1# Content with type: docs
2/content/installation.md (with type: docs)
3→ Looks for: /layouts/docs/single.html
4→ Falls back to: /layouts/_default/single.html
5
6# Content with type: gallery
7/content/vacation-photos.md (with type: gallery)
8→ Looks for: /layouts/gallery/single.html
9→ Falls back to: /layouts/_default/single.html
10
11# Content in blog section (auto-detected)
12/content/blog/my-post.md (no type specified)
13→ Auto-detected as: type: blog
14→ Looks for: /layouts/blog/single.html
15→ Falls back to: /layouts/_default/single.html
Use these commands to discover available types in your HBStack installation:
1# Find all type-specific layout directories
2find ~/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/hbstack/ -maxdepth 3 -path "*/layouts/*" -type d | grep -E "layouts/[^/]+$" | sed 's|.*/layouts/||' | grep -v "partials\|shortcodes\|_default" | sort | uniq
3
4# Results: archives, authors, blog, docs, gallery
5
6# Check your local archetypes
7find /home/ag-sayyed/Documents/projects-notes/archetypes/ -name "*.md" -exec basename {} .md \;
8
9# Results: blog, docs, docs-with-faq, gallery, projects, tutorials
1# See how modules check for specific types
2grep -r "\.Type" ~/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/hbstack/ --include="*.html"
3
4# Example findings:
5# {{- if eq .Page.Type "docs" }} # docs module checking for docs type
6# .RegularPages.GroupBy "Type" # blog module grouping by type
You can create custom types by:
/archetypes/projects.md/layouts/projects/single.html, /layouts/projects/list.htmltype: projects in frontmatterHBStack modules can have type-specific configuration:
1# From hbstack/docs module configuration
2[params.hb.full_width_types.docs]
3enable = true
4
5# This means docs type pages get full-width layout
blog, docs, gallery for rich functionality_default templates| Type | Purpose | Key Features | Layout Templates |
|---|---|---|---|
blog | Blog posts | Metadata, comments, related posts | blog/single.html, blog/list.html |
docs | Documentation | Sidebar, TOC, breadcrumbs | docs/single.html, docs/list.html |
gallery | Photo albums | Image grid, lightbox | gallery/single.html, gallery/list.html |
archives | Date archives | Date-based grouping | archives/ templates |
authors | Author profiles | Author info, post lists | authors/ templates |
page | Default/misc | Basic content rendering | _default/single.html |
charts | Custom charts | Interactive data visualizations | layouts/charts/single.html, charts/list.html |
The type system is Hugo’s way of organizing content and determining which templates to use, while HBStack extends this with rich, specialized templates for different content types!