Adjust .File usage to get rid of WARNINGs
Note that this requires this fix in Hugo 0.55.2: https://github.com/gohugoio/hugo/issues/5865
This commit is contained in:
parent
4054b1b520
commit
5affd26bfb
3 changed files with 7 additions and 5 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
public/
|
||||||
|
exampleSite/public/
|
|
@ -10,9 +10,9 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ with .Site.Params.BookEditPath }}
|
{{ with .Site.Params.BookEditPath }}
|
||||||
<div>
|
<div>
|
||||||
<a href="{{ $.Site.Params.BookRepo }}/{{ . }}/{{ $.File.Path }}" target="_blank" rel="noopener">
|
{{ if $.File }}<a href="{{ $.Site.Params.BookRepo }}/{{ . }}/{{ $.File.Path }}" target="_blank" rel="noopener">
|
||||||
<img src="{{ "svg/code-fork.svg" | relURL }}" /> Edit this page
|
<img src="{{ "svg/code-fork.svg" | relURL }}" /> Edit this page
|
||||||
</a>
|
</a>{{ end }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{{/*These templates contains some more complex logic and shared between partials*/}}
|
{{/*These templates contains some more complex logic and shared between partials*/}}
|
||||||
{{- define "title" -}}
|
{{- define "title" -}}
|
||||||
{{- if .Pages -}}
|
{{- if and .File .Pages -}}
|
||||||
{{ $sections := split (trim .Dir "/") "/" }}
|
{{ $sections := split (trim .File.Dir "/") "/" }}
|
||||||
{{ $title := index ($sections | last 1) 0 | humanize | title }}
|
{{ $title := index ($sections | last 1) 0 | humanize | title }}
|
||||||
{{- default $title .Title -}}
|
{{- default $title .Title -}}
|
||||||
{{- else -}}
|
{{- else if .File -}}
|
||||||
{{ $title := .File | humanize | title }}
|
{{ $title := .File | humanize | title }}
|
||||||
{{- default $title .Title -}}
|
{{- default $title .Title -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
Loading…
Reference in a new issue