Skip to content

4. Content & Front Matter

Will Holmes edited this page Aug 7, 2023 · 17 revisions

Customizations you can make with content and front matter.

Creating Posts & Projects

It's recommended to create posts as page bundles with the included bundle archetypes. You can create new posts with hugo new --kind post-bundle posts/bundle-name or projects with hugo new --kind project-bundle projects/bundle-name. To create posts in a subdirectory simply add the subdirectory name to the path: hugo new --kind post-bundle posts/subdir/bundle-name.

Alternatively, you can create posts or projects that aren't bundles with hugo new posts/post-name.md or hugo new projects/project-name.md. This will create a new post according to the default posts.md archetype defined in themes/hugo-liftoff/archetypes/.

Post Front Matter

The following front matter parameters can be viewed within themes/hugo-liftoff/archetypes/posts.md. When you create a new post with hugo new, they will auto-populate for you.

title

The title or <h1> of your post. If seo_title isn't set, title will also be used as the <title> tag for SEO. It's also used on any list pages where posts are listed, and in Open Graph / Twitter Cards / Google structured data markup. Defaults to the file or bundle name created via archetypes.

seo_title

Give your post a custom SEO <title> tag that differs from the post title. Overrides title.

summary

Overrides the description for any on-page post summaries. This includes list pages and the banner section of single posts. It's also used in schema markups and RSS.

description

The <meta> description for SEO purposes. If not set, the global site description in config.toml will be used.

If summary isn't set, the description will also be used as a fallback for any on-page post summaries. It's also used heavily in schema markups and RSS.

slug

The URL slug of your post. If not set, Hugo will use the file or page bundle name instead.

author

Override the global author site param in params.toml for the author meta in <head>.

draft

Builds your post in production mode if true. To build drafts in development, use hugo server -D.

date

The default date your post was created. Generated automatically by post archetypes.

lastmod

The last modified date of your post. This will add an extra "Updated" date entry to your posts on list and single pages and add indicators to each date to signify which is which. It's also used heavily by SEO schemas as a last_modified field.

expiryDate

If the expiry date is set to a date in the past, Hugo won't build the post.

publishDate

Overrides the date if set. If set in the future, the post won't be built by default unless you specify Hugo to build future posts with --buildFuture.

feature_image

Specify a custom image to use for the featured image of the post. If not specified, Hugo Pipes will look for feature.* in your page bundle and use that.

feature_image_alt

The alt text for the feature image. Works even if the default image is used and feature_image isn't set.

categories

Adds posts to the category taxonomy and lists them on the page for that term.

tags

Adds posts to the tag taxonomy and lists them on the page for that term.

series

A custom taxonomy. Add your post to a series of posts or create one if the series doesn't exist yet. Single pages will contain a list of all other posts in the series, along with a next/prev in series navigation at the end of the post. This will disable the standard next/prev posts links ("See Also") and related posts ("Read Next") at the bottom of posts.

toc

Add a toggle-able table of contents at the start of your post (on mobile) or sidebar (on desktop). Long TOCs that extend past the viewport vertically will be scrollable.

related

Include a list of related posts ("See Also") at the end of your post if they exist (will not be included if the post belongs to a series). See config/_default/config.toml for related post rules.

social_share

Add social share icons to the end of your post.

newsletter

Include a newsletter just above the footer after your post. If global_newsletter is false in params.toml, enabling it in front matter will override the global setting and vice-versa.

disable_comments

Disable comments on a per-post basis if global comments are enabled with disqusShortname in params.toml.

Project Front Matter

The following front matter parameters can be viewed within themes/hugo-liftoff/archetypes/projects.md. When you create a new project with hugo new, they will auto-populate for you.

Shared Parameters

The following parameters are shared with posts.

title
seo_title
summary
description
slug
author
draft
date
lastmod
expiryDate
publishDate
feature_image
feature_image_alt
newsletter

project types

A custom taxonomy. Tag your projects by the type of project (e.g. Client, Personal, Open Source, etc.). This will add an indicator in the top right corner of project cards and on the project single page. If you list more than one, only the first will be used for the indicator.

techstack

List the tech stack your project is built with, or any other set of data you want. This isn't a taxonomy so it won't create term pages for each one. However, you could easily add it as one to achieve this functionality.

live_url

The live URL of your project hosted somewhere. Will be added to project cards and in the banner of project single pages.

source_url

A link to the source code of your project. Will be added to project cards and in the banner of project single pages.

Page Customization

In addition to posts and projects, you can customize many aspects of the theme from a section page's _index.md file or a single page's index.md file. title, seo_title, summary and description are the most applicable choices.

Home Page

You can customize the home page by creating or editing an _index.md file at the top-level of your content directory. Shortcodes can be added to the content to customize homepage. See shortcodes for more details.

title

This will customize the main hero title of the home page.

subtitle

This will customize the main hero description/subtitle of the home page.

seo_title

Update the <title> tag with a custom SEO title instead of using the site title from config.toml.

primary_cta_page

Customize the homepage hero's primary CTA link based on a relative page/URL (e.g. about). If left blank, defaults to about. To customize the link text, set linktitle or title in the destination page's frontmatter. linktitle takes precedence over title.

secondary_cta_page

Same as above, but for the secondary CTA. If left blank, defaults to projects.

posts_section_heading

Customize the section heading for recent posts on the home page.

projects_section_heading

Same as above but for projects.

About Page

Create an about page by adding an about directory within content with a content/about/index.md file. Add type: about to the front matter and include title, seo_title and description fields if desired. The type is required so the theme uses the right template.

You can add additional body text within your markdown.

Contact Page

Same as above but using type: contact in front matter.

Generic Custom Pages

By default, creating content outside of posts and projects will use a default single template. This allows you to create generic single pages like terms and conditions or privacy policies without creating your own custom layouts for them. The same fields as about and contact pages apply, except a type is not required.

Nested Subsections

Hugo Liftoff supports nested subsections within your posts content. Create a directory within content/posts/ with a content/posts/_index.md file. Add title, seo_title, summary and description fields if desired.

Creating posts in a subsection works the same as creating regular posts. Simply add the subsection to the hugo new path.

To modify the permalink (e.g. from /posts/subsection/ to just /subsection/), add a url: subsection parameter to your front matter on the relevant section index page.