Improve logic in title template for less warnings
This commit is contained in:
+1
-1
@@ -9,7 +9,7 @@
|
||||
|
||||
<body>
|
||||
<main class="flex justify-center">
|
||||
<h1>404 Not Found</h1>
|
||||
<h1>404 Not Found</h1>
|
||||
</main>
|
||||
|
||||
{{ partial "docs/inject/body" . }}
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ You can override this page in:
|
||||
` }}
|
||||
<body>
|
||||
<main class="flex justify-center">
|
||||
<div class="book-page markdown">
|
||||
<div class="book-home markdown">
|
||||
{{ replace $content "`" "`" | markdownify }}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
<!-- RSS -->
|
||||
{{ with .OutputFormats.Get "rss" -}}
|
||||
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
||||
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
||||
{{ end -}}
|
||||
|
||||
{{ "<!--" | safeHTML }}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
{{/*These templates contains some more complex logic and shared between partials*/}}
|
||||
{{ define "title" }}
|
||||
{{ if and .File .Pages }}
|
||||
{{ if and .IsSection .File }}
|
||||
{{ $sections := split (trim .File.Dir "/") "/" }}
|
||||
{{ $title := index ($sections | last 1) 0 | humanize | title }}
|
||||
{{ default $title .Title }}
|
||||
{{ else if .File }}
|
||||
{{ $title := .File.BaseFileName | humanize | title }}
|
||||
{{ else if and .IsPage .File }}
|
||||
{{ $title := .File.BaseFileName | humanize | title }}
|
||||
{{ default $title .Title }}
|
||||
{{ else }}
|
||||
{{ .Title }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user