How to add tag and category

Ask for help again.
This time I want to add tag and category in my site.
After reading some documents in gohugo, I think I just need to add tag and category in my front matter.

+++
date = "2016-04-20T19:23:51+08:00"
draft = false
title = "Naive Bayesian"
tag = [“bayes”]
category = [“machine learning”]
slug = “naive-bayesian”
+++

But I couldn’t see any difference in my page.
There is nothing under the Tag and Category.
What else should I do?

I have this question too!

You have to name the frontmatter variables tags and categories. You use their non-existing singular form.

okay. I went back to the document of Taxonomies and got what you mean. It works now. Thanks a lot.

I hope you get the answer now.
you can refer to use of taxonomies

@eleanorTFang

Tags and categories are supported out of the box, I believe, but if you wanted to add them to your config, the following gives you an idea of how you can add your taxonomies and then leverage them in individual front matter in individual markdown files.

In your config.toml =

[taxonomies]
   tag = "tags"
   category = "categories"

Then in the yaml front matter for content/blog/examplepost.md:

title: My Blog Post
categories: [development, publishing]
tags: [hugo,content,static site generator]

Cheers.

3 Likes

Yeah. You guys really help me a lot.