Skip to content

Commit

Permalink
Merge pull request #1244 from gethinode/develop
Browse files Browse the repository at this point in the history
Support configuration of internal links validation
  • Loading branch information
markdumay authored Oct 18, 2024
2 parents 5f4070b + 1338df7 commit 548a2fa
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
2 changes: 2 additions & 0 deletions config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
footerBelowFold = false
loading = "lazy"
breakpoint = "md"
[main.internalLinks]
validate = true
[main.externalLinks]
cue = false
tab = false
Expand Down
2 changes: 2 additions & 0 deletions exampleSite/config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
footerBelowFold = false
loading = "lazy"
breakpoint = "md"
[main.internalLinks]
validate = true
[main.externalLinks]
cue = true
tab = true
Expand Down
11 changes: 6 additions & 5 deletions layouts/partials/assets/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@
{{- $page := "" }}
{{- if .path }}
{{ $page = partial "utilities/GetPage.html" (dict "url" .path "page" page) }}
{{- if not $page }}
{{ $validate := site.Params.main.internalLinks.validate | default true }}
{{- if and $validate (not $page) }}
{{ if page.File }}
{{- errorf "partial [assets/card.html] - Cannot find target page '%s', see '%s'" .path page.File.Path -}}
{{- warnf "partial [assets/card.html] - Cannot find target page '%s', see '%s'" .path page.File.Path -}}
{{ else }}
{{- errorf "partial [assets/card.html] - Cannot find target page '%s'" .path -}}
{{- warnf "partial [assets/card.html] - Cannot find target page '%s'" .path -}}
{{ end }}
{{- end }}
{{- end }}
Expand Down Expand Up @@ -95,7 +96,7 @@

{{- if $href -}}
<a href="{{ $href }}" class="{{ if $color }}link-bg-{{ $color }}{{ else }}card-body-link{{ end }} stretched-link">
<p class="card-title fs-lg-5 fs-6 fw-bold">{{ $title }}</p>
<p class="card-title fs-lg-5 fs-6">{{ $title }}</p>
{{ with $description }}
<div class="card-text {{ if $color }}link-bg-{{ $color }}{{ else }}card-body-link{{ end }}">
{{ . | safeHTML }}
Expand All @@ -104,7 +105,7 @@
</a>
{{- else -}}
<div>
{{ with $title }}<p class="card-title fs-lg-5 fs-6 fw-bold">{{ . }}</p>{{ end -}}
{{ with $title }}<p class="card-title fs-lg-5 fs-6">{{ . }}</p>{{ end -}}
{{ with $description }}<div class="card-text">{{ . | safeHTML }}</div>{{ end -}}
</div>
{{- end -}}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gethinode/hinode",
"version": "0.27.0-beta5",
"version": "0.27.0-beta6",
"description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator",
"keywords": [
"hugo",
Expand Down

0 comments on commit 548a2fa

Please sign in to comment.