1. Front side of the track
, * , MD , front matter .md. Hugo , . .
, .MD, -, (, <div>) .
, .md :
---
title: "Post about the front matter"
<more key pairs>
nointro: false
---
nointro: true . , false, . <div>.
nointro :
, , -:
<div class="article-body {{ if .Params.nointro }} no_intro {{ end }}">
{{ .Content }}
</div>
, {{ .Content }}, .
, hugo/themes/highlighter/layouts/partials/blog-single-content.html, . .
, Boolean, , :
MD :
---
title: "One of our clients"
<more key pairs>
companyname: "Code and Send Ltd"
---
Text content is put here.
, ( IF):
Hugo:
{{ if .Params.companyname }}{{ .Params.companyname }}{{ end }}
2. config. (Toml/yaml/json)
, , " " , , hugo/config.toml. companyname config, :
hugo/config.toml:
BaseURL = "_%%WWWPATH%%_"
languageCode = "en-uk"
title = "Code and Send"
pygmentsUseClasses = true
author = "Roy Reveltas"
theme = "Highlighter"
[params]
companyname = ""
- {{ .Site.Params.headercommentblock }}.
, , , , , , -. , , . , .
3. Gulp/npm
, *, , .
, : 1) Prod 2) Dev. Prod URL- : CDN . Dev , .
, ( ): _%%WWWPATH%%_ _%%CDNPATH%%_. , , . hugo/config.toml :
hugo/config.toml:
BaseURL = "_%%WWWPATH%%_"
, , HTML Grunt:
grunt:
replace: {
dev: {
options: {
patterns: [{
match: /_%%CDNPATH%%_+/g,
replacement: function () {
return 'http://127.0.0.1:1313/'
}
}, {
match: /_%%WWWPATH%%_+/g,
replacement: function () {
return 'http://127.0.0.1:1313/'
}
}...
Gulp / npm , Grunt. , Grunt .
, , Hugo params, Hugo , placeholder - , .
catch, Gulp/Grunt/npm scripts, Husky npm, - (, %%_). , Husky -, :
package.json :
"scripts": {
"no-spilled-placeholders": "echo \"\n\\033[0;93m* Checking for spilled placeholders:\\033[0m\"; grep -q -r \"%%_\" dist/ && echo \"Placeholders found! Stopping.\n\" && exit 1 || echo \"All OK.\n\"",
"precommit": "npm run no-spilled-placeholders"
},
, grep %%_ , . , JSON. ( ) . - , : %_, _%, %__, __% ..