Skip to content

Commit

Permalink
Allow Powered By Link Configuration (#2)
Browse files Browse the repository at this point in the history
* fix: add back empty content filter in search-data.json (imfing#482)

* Add Hugo Lock File for Example Site

* Center Headings Text and Flex Column Items on Home Layout

* Explicitly Add Prettier Plugin

* Allow Configuring Powered By Link

* Use Existing Variable for Powered By Text

---------

Co-authored-by: Xin <[email protected]>
Co-authored-by: Liam Elliott <[email protected]>
  • Loading branch information
3 people authored Oct 28, 2024
1 parent fa3c935 commit 9ac05d9
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"plugins": [
"prettier-plugin-go-template"
],
"overrides": [
{
"files": [
Expand Down
1 change: 1 addition & 0 deletions assets/json/search-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

{{- $pages := where .Site.Pages "Kind" "in" (slice "page" "section") -}}
{{- $pages = where $pages "Params.excludeSearch" "!=" true -}}
{{- $pages = where $pages "Content" "!=" "" -}}

{{- $output := dict -}}

Expand Down
37 changes: 28 additions & 9 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,38 @@
class="{{ $footerWidth }} hx-mx-auto hx-flex hx-justify-center hx-py-12 hx-pl-[max(env(safe-area-inset-left),1.5rem)] hx-pr-[max(env(safe-area-inset-right),1.5rem)] hx-text-gray-600 dark:hx-text-gray-400 md:hx-justify-start"
>
<div class="hx-flex hx-w-full hx-flex-col hx-items-center sm:hx-items-start">
{{- if (.Site.Params.footer.displayPoweredBy | default true) }}<div class="hx-font-semibold">{{ template "theme-credit" $poweredBy }}</div>{{ end }}
{{- if .Site.Params.footer.displayCopyright }}<div class="hx-mt-6 hx-text-xs">{{ $copyright | markdownify }}</div>{{ end }}
{{- if (.Site.Params.footer.displayPoweredBy | default true) }}
<div class="hx-font-semibold">
{{ template "theme-credit" (dict
"text" ($poweredBy | markdownify)
"link" .Site.Params.footer.poweredBy.link
)
}}
</div>
{{ end }}
{{- if .Site.Params.footer.displayCopyright }}
<div class="hx-mt-6 hx-text-xs">{{ $copyright | markdownify }}</div>
{{ end }}
</div>
</div>
</footer>

{{- define "theme-credit" -}}
<a class="hx-flex hx-text-sm hx-items-center hx-gap-1 hx-text-current" target="_blank" rel="noopener noreferrer" title="Hextra GitHub Homepage" href="https://github.com/imfing/hextra">
<span>
{{- . | markdownify -}}
{{- if strings.Contains . "Hextra" -}}
{{ define "theme-credit" }}
{{ if .link }}
<a class="hx-flex hx-text-sm hx-items-center hx-gap-1 hx-text-current" target="_blank" rel="noopener noreferrer" title="{{ T "poweredBy" }}" href="{{ .link }}">
<span>
{{- T "poweredBy" | markdownify -}}
{{- if strings.Contains (T "poweredBy") "Hextra" -}}
{{- partial "utils/icon.html" (dict "name" "hextra" "attributes" `height=1em class="hx-inline-block ltr:hx-ml-1 rtl:hx-mr-1 hx-align-[-2.5px]"`) -}}
{{- end -}}
</span>
</a>
{{ else }}
<span class="hx-text-sm">
{{- T "poweredBy" | markdownify -}}
{{- if strings.Contains (T "poweredBy") "Hextra" -}}
{{- partial "utils/icon.html" (dict "name" "hextra" "attributes" `height=1em class="hx-inline-block ltr:hx-ml-1 rtl:hx-mr-1 hx-align-[-2.5px]"`) -}}
{{- end -}}
</span>
</a>
{{- end -}}
{{ end }}
{{ end }}

0 comments on commit 9ac05d9

Please sign in to comment.