Bug Fix: Empty .Site.Params.contentDir (#312)
* Bug Fix: Empty .Site.Params.contentDir When .Site.Params.contentDir is left as the default: "content", calling .Site.Params.contentDir returns nothing, or maybe an empty string. To fix this, we set a default value for .Site.Params.contentDir to "content" and the url is built correctly. * Use the `default` function instead of `or` https://gohugo.io/functions/default/
This commit is contained in:
parent
27c1791144
commit
9791db1ce7
1 changed files with 1 additions and 1 deletions
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
{{ if and .File .Site.Params.BookRepo .Site.Params.BookEditPath }}
|
{{ if and .File .Site.Params.BookRepo .Site.Params.BookEditPath }}
|
||||||
<div>
|
<div>
|
||||||
<a class="flex align-center" href="{{ .Site.Params.BookRepo }}/{{ .Site.Params.BookEditPath }}/{{ .Site.Params.contentDir }}/{{ replace .File.Path "\\" "/" }}" target="_blank" rel="noopener">
|
<a class="flex align-center" href="{{ .Site.Params.BookRepo }}/{{ .Site.Params.BookEditPath }}/{{ .Site.Params.contentDir | default "content" }}/{{ replace .File.Path "\\" "/" }}" target="_blank" rel="noopener">
|
||||||
<img src="{{ "svg/edit.svg" | relURL }}" class="book-icon" alt="Edit" />
|
<img src="{{ "svg/edit.svg" | relURL }}" class="book-icon" alt="Edit" />
|
||||||
<span>{{ i18n "Edit this page" }}</span>
|
<span>{{ i18n "Edit this page" }}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in a new issue