Skip to content

Commit 1d0b006

Browse files
feat: add h1 param to front matter (#333)
1 parent 6d3b1d6 commit 1d0b006

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

exampleSite/content/posts/theme-documentation-advanced.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,25 @@ and the `metaKeywords` specified in the config.toml:
319319
metaKeywords = ["blog", "gokarna", "hugo"]
320320
```
321321

322+
## Page title and H1
323+
324+
By default, Gokarna uses `.Title` for the `<title>` and `<h1>` elements, in addition to the OpenGraph (`og:title`) and Twitter (`twitter:title`) properties within `<meta>` elements.
325+
326+
```yaml
327+
---
328+
title: "8 Facts About Me - #7 Will Shock You!"
329+
---
330+
```
331+
332+
To define H1 separately from the page title, use the `h1` param in your front matter:
333+
334+
```yaml
335+
---
336+
title: "8 Facts About Me - #7 Will Shock You!"
337+
h1: "8 Facts About Me"
338+
---
339+
```
340+
322341
## Hide tags, date or description of posts
323342

324343
Tags can be used to categorize posts (e.g.: Project or Blog), and be hidden on

layouts/partials/page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="post container">
22

33
<div class="post-header-section">
4-
<h1>{{ .Title | markdownify }}</h1>
4+
<h1>{{ or (.Params.H1 | markdownify) (.Title | markdownify) }}</h1>
55
</div>
66

77
<div class="post-content">

layouts/partials/post.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="post container">
22
<div class="post-header-section">
3-
<h1>{{ .Title | markdownify }}</h1>
3+
<h1>{{ or (.Params.H1 | markdownify) (.Title | markdownify) }}</h1>
44

55
{{/* Determine whether to display the date & description based on tags */}}
66

0 commit comments

Comments
 (0)