-
Notifications
You must be signed in to change notification settings - Fork 29
4. Content & Front Matter
Customizations you can make with content and front matter.
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/
.
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.
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.
Give your post a custom SEO <title>
tag that differs from the post title. Overrides title
.
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.
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.
The URL slug of your post. If not set, Hugo will use the file or page bundle name instead.
Override the global author
site param in params.toml
for the author meta in <head>
.
Builds your post in production mode if true
. To build drafts in development, use hugo server -D
.
The default date your post was created. Generated automatically by post archetypes.
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.
If the expiry date is set to a date in the past, Hugo won't build the post.
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
.
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.
The alt text for the feature image. Works even if the default image is used and feature_image
isn't set.
Adds posts to the category taxonomy and lists them on the page for that term.
Adds posts to the tag taxonomy and lists them on the page for that term.
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.
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.
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.
Add social share icons to the end of your post.
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 on a per-post basis if global comments are enabled with disqusShortname
in params.toml
.
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.
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
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.
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.
The live URL of your project hosted somewhere. Will be added to project cards and in the banner of project single pages.
A link to the source code of your project. Will be added to project cards and in the banner of project single pages.
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.
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.
This will customize the main hero title of the home page.
This will customize the main hero description/subtitle of the home page.
Update the <title>
tag with a custom SEO title instead of using the site title from config.toml
.
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
.
Same as above, but for the secondary CTA. If left blank, defaults to projects
.
Customize the section heading for recent posts on the home page.
Same as above but for projects.
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.
Same as above but using type: contact
in front matter.
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.
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.