What is the . Context refering to in Archetypes?

Regular page

Command

hugo new content/en/posts/post-1.md

Values inserted in markdown

Action Value
{{ .Date }} 2023-02-07T14:01:33-08:00
{{ .Name }} post-1 (returns .Page.File.ContentBaseName)
{{ .Type }} posts
{{ .Page.File.BaseFileName }} post-1
{{ .Page.File.ContentBaseName }} post-1
{{ .Page.File.Dir }} posts/
{{ .Page.File.Ext }} md
{{ .Page.File.LogicalName }} post-1.md
{{ .Page.File.Path }} posts/post-1.md
{{ .Page.File.TranslationBaseName }} post-1
{{ .Page.File.UniqueID }} 11100be4dc48b9153759ce466b02d6ed
{{ .Page.Site }} Site("My Site")
{{ .Page.Site.LanguageCode }} en-US
{{ .Page.Site.Title }} My Site
{{ .Site }} Site("My Site") (returns .Page.Site)
{{ mul 6 7 }} 42 (you can use any function)

Leaf Bundle

Command

hugo new content/en/posts/post-2/index.md

Values inserted in markdown

Action Value
{{ .Date }} 2023-02-07T14:05:04-08:00
{{ .Name }} post-2 (returns .Page.File.ContentBaseName)
{{ .Type }} posts
{{ .Page.File.BaseFileName }} index
{{ .Page.File.ContentBaseName }} post-2
{{ .Page.File.Dir }} posts/post-2/
{{ .Page.File.Ext }} md
{{ .Page.File.LogicalName }} index.md
{{ .Page.File.Path }} posts/post-2/index.md
{{ .Page.File.TranslationBaseName }} index
{{ .Page.File.UniqueID }} 1e8f8595b3abc8dc24e306ff0d8ff78b
{{ .Page.Site }} Site("My Site")
{{ .Page.Site.LanguageCode }} en-US
{{ .Page.Site.Title }} My Site
{{ .Site }} Site("My Site") (returns .Page.Site)
{{ mul 6 7 }} 42 (you can use any function)

Branch bundle

Command

hugo new content/en/posts/_index.md

Values inserted in markdown

Action Value
{{ .Date }} 2023-02-07T14:06:04-08:00
{{ .Name }} posts (returns .Page.File.ContentBaseName)
{{ .Type }} posts
{{ .Page.File.BaseFileName }} _index
{{ .Page.File.ContentBaseName }} posts
{{ .Page.File.Dir }} posts/
{{ .Page.File.Ext }} md
{{ .Page.File.LogicalName }} _index.md
{{ .Page.File.Path }} posts/_index.md
{{ .Page.File.TranslationBaseName }} _index
{{ .Page.File.UniqueID }} a74dbcb35ee06db2c5314e7ff0d9268f
{{ .Page.Site }} Site("My Site")
{{ .Page.Site.LanguageCode }} en-US
{{ .Page.Site.Title }} My Site
{{ .Site }} Site("My Site") (returns .Page.Site)
{{ mul 6 7 }} 42 (you can use any function)
2 Likes