Inline Tables with Hugo Template not working

Hi All,

I am moving my frontmatter from YAML to TOML to allow me to use inline tables for better formatting of the data, unfortunatly I dont seem to be able to get the data parsed to the template. I am sure I am missing something silly, here is my code:

date = "2018-01-25T20:02:33+00:00"
title = "Article Title"
authors = "Me"
categories = ["Article"]
slug = "article-title"

type = "article"

  card = "summary"
  site = "@twittername"
  title = "Special Title for the Card"
  description = "Special Description for the card max. 200 characters"
  image = ""

Here is the template, its pretty simple to just output the data from the twitter section, all other values seem to populate the template:

<title>{{ .Title }}</title>
{{ printf "%s" $.Params.twitter }}

Hope someone can help as its driving me crazy :slight_smile:

Inline Tables with Hugo Template not working

You need to elaborate on what you mean by “not working”.

Side notes about {{ printf "%s" $.Params.twitter }}:

  1. You don’t need the $.
  2. As twitter is a map, you will get more useful output by using a 2-variable range.

If you take the debugprint.html partial that I have, and use it as {{ partial "debugprint.html" .Params }} in a single layout file, you will see that front-matter in this form:

So… the data from your TOML table twitter is getting read properly. So the question is: What “doesn’t work”? :smile: