Add docs/data/titles.toml to set title "Site Showcase"
authorAnthony Fok <foka@debian.org>
Mon, 16 Nov 2015 13:48:20 +0000 (06:48 -0700)
committerAnthony Fok <foka@debian.org>
Mon, 16 Nov 2015 13:48:20 +0000 (06:48 -0700)
Idea from https://discuss.gohugo.io/t/how-to-name-list-templates/949

docs/data/titles.toml [new file with mode: 0644]
docs/layouts/partials/header.html

diff --git a/docs/data/titles.toml b/docs/data/titles.toml
new file mode 100644 (file)
index 0000000..2348c85
--- /dev/null
@@ -0,0 +1,2 @@
+[Showcase]
+title = "Site Showcase"
index d06bf4913c93cb612d9bb7d1e93ec936595c92cc..58922fb82c9702356f4d9a51a388028fa97714f0 100644 (file)
@@ -7,8 +7,8 @@
     {{ with .Site.Params.author }}<meta name="author" content="{{ . }}">{{ end }}
     {{ .Hugo.Generator }}
     <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
-
-    <title>{{.Title}}</title>
+{{ .Scratch.Add "title" "" }}{{ if isset .Site.Data.titles .Title }}{{ .Scratch.Set "title" (index .Site.Data.titles .Title).title }}{{ else }}{{ .Scratch.Set "title" .Title}}{{end}}
+    <title>Hugo - {{ .Scratch.Get "title" }}</title>
 
     <link href="/css/bootstrap-theme.css" rel="stylesheet">
     <link href="/assets/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
@@ -42,7 +42,7 @@
             </div>
 
             <div class="nav title-row" id="top_menu">
-                <h1 class="nav top-menu">{{.Title}}</h1>
+                <h1 class="nav top-menu">{{ .Scratch.Get "title" }}</h1>
             </div>
       </header>
       <!--header end-->
@@ -78,7 +78,7 @@
                 <div class="col-md-10">
                     <section class="panel">
                           <!--<header class="panel-heading">-->
-                              <!--<h3>{{.Title}}</h3>-->
+                              <!--<h3>{{ .Scratch.Get "title" }}</h3>-->
                           <!--</header>-->
                     <div class="panel-body">
                         <div class="row">