Skip to content

Commit 0bc26e3

Browse files
feat: custom head title (#950)
### Prerequisites Put an `x` into the box(es) that apply: - [ ] This pull request fixes a bug. - [x] This pull request adds a feature. - [ ] This pull request introduces breaking change. ### Description This PR makes it possible to configure a custom head title, without having to override the baseof template. ### Issues Resolved #811 ### Checklist Put an `x` into the box(es) that apply: #### General - [ ] Describe what changes are being made - [ ] Explain why and how the changes were necessary and implemented respectively - [ ] Reference issue with `#<ISSUE_NO>` if applicable --------- Co-authored-by: Luiz F. A. de Prá <[email protected]>
1 parent 51f3348 commit 0bc26e3

File tree

2 files changed

+32
-31
lines changed

2 files changed

+32
-31
lines changed

docs/configurations.md

+31-29
Original file line numberDiff line numberDiff line change
@@ -126,35 +126,37 @@ Alternatively, it is possible to use custom styles with generated CSS files. See
126126

127127
These are all the parameters used by `hugo-coder` theme.
128128

129-
| Name | Type | Required | Description | Default | Example |
130-
| ----------------------------- | ------ | -------- | ------------------------------------------------ | -------------------------------- | ------------------------------------------------ |
131-
| author | string | Yes | Author name. | | `"John Doe"` |
132-
| info | string | Yes | An headline, job title or similar. | | `"Full Stack Developer"` |
133-
| description | string | Yes | Description of the site. | | `"John Doe's personal website"` |
134-
| keywords | string | Yes | Site keywords. | | `"blog,developer,personal"` |
135-
| avatarURL | string | No | Photo of the author. | | `"images/avatar.jpg"` |
136-
| gravatar | string | No | Gravatar photo of the author | | `"[email protected]"` |
137-
| fediverseCreator | string | No | The author's fediverse handle. | | `"@[email protected]"` |
138-
| faviconSVG | string | No | Custom path to a SCG favicon. | `"/img/favicon.svg"` | `"/img/favicon.svg"` |
139-
| favicon_32 | string | No | Custom path to a 32x32 favicon. | `"/img/favicon-32x32.png"` | `"/img/favicon-32x32.png"` |
140-
| favicon_16 | string | No | Custom path to a 16x16 favicon. | `"/img/favicon-16x16.png"` | `"/img/favicon-16x16.png"` |
141-
| touchIcon | string | No | Custom path to an apple-touch-icon | `"/images/apple-touch-icon.png"` | `"/images/apple-touch-icon.png"` |
142-
| mask_icon | string | No | Custom path to a mask-icon | `"/images/safari-pinned-tab.svg"` | `"/images/safari-pinned-tab.svg"` |
143-
| mask_icon_color | string | No | Custom color for mask-icon color | `"#5bbad5"` | `"#5bbad5"` |
144-
| since | string | No | Date shown in the footer before now year | | `"2020"` |
145-
| maxSeeAlsoItems | number | No | Series see also post count | `5` | `10` |
146-
| commit | string | No | Show the last git commit in the footer | | `"https://github.com/luizdepra/hugo-coder/tree/"`|
147-
| rtl | bool | No | Enable the Right To Left mode. | `false` | `true` or `false` |
148-
| math | bool | No | Enable MathJax Module and add JS into your site. | `false` | `true` or `false` |
149-
| katex | bool | No | Enable KaTeX for all content types. | `false` | `true` or `false` |
150-
| colorScheme | string | No | Specify light/dark colorscheme | `"auto"` | `"auto"` or `"light"` or `"dark"` |
151-
| hideColorSchemeToggle | bool | No | If true, hides the color scheme toggle | `false` | `true` or `false` |
152-
| customCSS | list | No | Add extra CSS files to the website. | [] | `["css/extra-style.css"]` |
153-
| customSCSS | list | No | Add extra SCSS files to the website. | [] | `["scss/extra-style.scss"]` |
154-
| customJS | list | No | Add extra JS files to the website. | [] | `["js/extra-script.js"]` |
155-
| customRemoteJS | list | No | Add extra remote JS files to the website. | [] | `["https://www.example.com/file.js"]` |
156-
| enableTwemoji | bool | No | Adds support for Twemoji | `false` | `true` or `false` |
157-
| disableDefaultJsScripts | bool | No | If true, disables default js scripts (coder.js) | `false` | `true` or `false` |
129+
| Name | Type | Required | Description | Default | Example |
130+
| ----------------------- | ------ | -------- | ------------------------------------------------------------------------ | --------------------------------- | ------------------------------------------------- |
131+
| author | string | Yes | Author name. | | `"John Doe"` |
132+
| info | string | Yes | An headline, job title or similar. | | `"Full Stack Developer"` |
133+
| description | string | Yes | Description of the site. | | `"John Doe's personal website"` |
134+
| keywords | string | Yes | Site keywords. | | `"blog,developer,personal"` |
135+
| avatarURL | string | No | Photo of the author. | | `"images/avatar.jpg"` |
136+
| gravatar | string | No | Gravatar photo of the author | | `"[email protected]"` |
137+
| fediverseCreator | string | No | The author's fediverse handle. | | `"@[email protected]"` |
138+
| faviconSVG | string | No | Custom path to a SCG favicon. | `"/img/favicon.svg"` | `"/img/favicon.svg"` |
139+
| favicon_32 | string | No | Custom path to a 32x32 favicon. | `"/img/favicon-32x32.png"` | `"/img/favicon-32x32.png"` |
140+
| favicon_16 | string | No | Custom path to a 16x16 favicon. | `"/img/favicon-16x16.png"` | `"/img/favicon-16x16.png"` |
141+
| touchIcon | string | No | Custom path to an apple-touch-icon | `"/images/apple-touch-icon.png"` | `"/images/apple-touch-icon.png"` |
142+
| mask_icon | string | No | Custom path to a mask-icon | `"/images/safari-pinned-tab.svg"` | `"/images/safari-pinned-tab.svg"` |
143+
| mask_icon_color | string | No | Custom color for mask-icon color | `"#5bbad5"` | `"#5bbad5"` |
144+
| since | string | No | Date shown in the footer before now year | | `"2020"` |
145+
| maxSeeAlsoItems | number | No | Series see also post count | `5` | `10` |
146+
| commit | string | No | Show the last git commit in the footer | | `"https://github.com/luizdepra/hugo-coder/tree/"` |
147+
| rtl | bool | No | Enable the Right To Left mode. | `false` | `true` or `false` |
148+
| math | bool | No | Enable MathJax Module and add JS into your site. | `false` | `true` or `false` |
149+
| katex | bool | No | Enable KaTeX for all content types. | `false` | `true` or `false` |
150+
| colorScheme | string | No | Specify light/dark colorscheme | `"auto"` | `"auto"` or `"light"` or `"dark"` |
151+
| hideColorSchemeToggle | bool | No | If true, hides the color scheme toggle | `false` | `true` or `false` |
152+
| customCSS | list | No | Add extra CSS files to the website. | [] | `["css/extra-style.css"]` |
153+
| customSCSS | list | No | Add extra SCSS files to the website. | [] | `["scss/extra-style.scss"]` |
154+
| customJS | list | No | Add extra JS files to the website. | [] | `["js/extra-script.js"]` |
155+
| customRemoteJS | list | No | Add extra remote JS files to the website. | [] | `["https://www.example.com/file.js"]` |
156+
| enableTwemoji | bool | No | Adds support for Twemoji | `false` | `true` or `false` |
157+
| disableDefaultJsScripts | bool | No | If true, disables default js scripts (coder.js) | `false` | `true` or `false` |
158+
| HeadTitle | string | No | When configured, it overrides the `<title>` tag with the provided string | "" | `"My custom title"` |
159+
158160

159161
### Social Icons Configuration
160162

layouts/_default/baseof.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="{{ .Site.Language.Lang }}">
33

44
<head>
5-
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
5+
<title>{{ block "title" . }}{{ .Site.Params.HeadTitle | default .Site.Title }}{{ end }}</title>
66
{{ partial "head.html" . }}
77
</head>
88

@@ -134,5 +134,4 @@
134134

135135
{{- partial "body/extensions" . -}}
136136
</body>
137-
138137
</html>

0 commit comments

Comments
 (0)