Compare commits

...

7 Commits

Author SHA1 Message Date
352269b9c2 Merge 712e670f9d into 94624bcac6 2024-10-12 10:36:53 +02:00
94624bcac6 docs(showcase): add Install C (#463)
Some checks failed
Deploy Hugo site to Pages / build (push) Has been cancelled
Deploy Hugo site to Pages / deploy (push) Has been cancelled
* Add Install C to Showcase

* fix: malformed image link

---------

Co-authored-by: Xin <xin@imfing.com>
2024-09-29 10:27:03 +01:00
712e670f9d fix: add hx- prefix to classes 2024-04-04 21:47:57 +02:00
Xin
2df115a195 fix: add missing page context for params access 2024-04-02 21:15:03 +01:00
Xin
365d78da13 chore: remove unused var 2024-04-02 21:09:43 +01:00
f87f19fb74 Fixes after review
- `where` > `location`
- Edit link > in a partial
2024-04-02 12:31:49 +02:00
795755bf9b feat: add configurable edit link position
- Add a `where` parameter to `editURL`
- Allow user to choose between `toc` (default) and `single`
- Add to single through last-updated partial
2024-04-01 12:58:43 +02:00
5 changed files with 41 additions and 17 deletions

View File

@ -13,6 +13,13 @@ Open source projects powered by Hextra
{{< cards >}} {{< cards >}}
{{< card
link="https://github.com/welding-torch/installc"
title="Install C"
image="https://github.com/user-attachments/assets/c9a85327-c7e7-40f1-830a-b4190a5e47bd"
imageStyle="object-fit:cover; aspect-ratio:16/9;"
>}}
{{< card {{< card
link="https://github.com/axivo/website" link="https://github.com/axivo/website"
title="AXIVO Docs" title="AXIVO Docs"

View File

@ -142,6 +142,7 @@ params:
editURL: editURL:
enable: true enable: true
location: "toc" # single | toc
base: "https://github.com/imfing/hextra/edit/main/exampleSite/content" base: "https://github.com/imfing/hextra/edit/main/exampleSite/content"
blog: blog:

View File

@ -0,0 +1,28 @@
{{- $editThisPage := (T "editThisPage") | default "Edit this page"}}
{{- $context := .context -}}
{{- $linkClass := "hx-mb-4 hx-block hx-text-xs hx-text-gray-500 ltr:hx-text-right rtl:hx-text-left dark:hx-text-gray-400" -}}
{{- if and (site.Params.editURL.enable) (eq site.Params.editURL.location .source) -}}
{{- $editURL := site.Params.editURL.base | default "" -}}
{{- with $context.Params.editURL -}}
{{/* if `editURL` is set in the front matter */}}
{{- $editURL = . -}}
{{- else -}}
{{- with $context.File -}}
{{/* `.FileInfo.Meta.SourceRoot` is a Hugo internal field, e.g. `/path/to/repo/content/en/` */}}
{{- $sourceDir := replace (strings.TrimPrefix .FileInfo.Meta.BaseDir .FileInfo.Meta.SourceRoot) "\\" "/" -}}
{{- $sourceDir = strings.TrimPrefix "/content" $sourceDir -}}
{{- $path := replace .Path "\\" "/" -}}
{{- $editURL = urls.JoinPath $editURL $sourceDir $path -}}
{{- end -}}
{{- end -}}
{{- if eq site.Params.editURL.location "toc" -}}
{{- $linkClass = "hx-text-xs hx-font-medium hx-text-gray-500 hover:hx-text-gray-900 dark:hx-text-gray-400 dark:hover:hx-text-gray-100 contrast-more:hx-text-gray-800 contrast-more:dark:hx-text-gray-50" -}}
{{- end -}}
<a class="{{ $linkClass }}" href="{{ $editURL }}" target="_blank" rel="noreferer">{{ $editThisPage }}</a>
{{- end -}}

View File

@ -1,9 +1,12 @@
{{- $lastUpdated := (T "lastUpdated") | default "Last updated on" -}} {{- $lastUpdated := (T "lastUpdated") | default "Last updated on" -}}
{{- if site.Params.displayUpdatedDate -}} {{- if site.Params.displayUpdatedDate -}}
<div class="hx-mt-12 hx-mb-8 hx-block hx-text-xs hx-text-gray-500 ltr:hx-text-right rtl:hx-text-left dark:hx-text-gray-400">
{{ partial "components/edit-url.html" (dict "source" "single" "context" .) }}
{{- with .Lastmod -}} {{- with .Lastmod -}}
{{ $datetime := (time.Format "2006-01-02T15:04:05.000Z" .) }} {{ $datetime := (time.Format "2006-01-02T15:04:05.000Z" .) }}
<div class="hx-mt-12 hx-mb-8 hx-block hx-text-xs hx-text-gray-500 ltr:hx-text-right rtl:hx-text-left dark:hx-text-gray-400">{{ $lastUpdated }} <time datetime="{{ $datetime }}">{{ partial "utils/format-date" . }}</time></div> <div class="hx-mt-4">{{ $lastUpdated }} <time datetime="{{ $datetime }}">{{ partial "utils/format-date" . }}</time></div>
</div>
{{- else -}} {{- else -}}
<div class="hx-mt-16"></div> <div class="hx-mt-16"></div>
{{- end -}} {{- end -}}

View File

@ -24,22 +24,7 @@
{{/* TOC bottom part */}} {{/* TOC bottom part */}}
<div class="{{ $borderClass }} hx-sticky hx-bottom-0 hx-flex hx-flex-col hx-items-start hx-gap-2 hx-pb-8 dark:hx-border-neutral-800 contrast-more:hx-border-t contrast-more:hx-border-neutral-400 contrast-more:hx-shadow-none contrast-more:dark:hx-border-neutral-400"> <div class="{{ $borderClass }} hx-sticky hx-bottom-0 hx-flex hx-flex-col hx-items-start hx-gap-2 hx-pb-8 dark:hx-border-neutral-800 contrast-more:hx-border-t contrast-more:hx-border-neutral-400 contrast-more:hx-shadow-none contrast-more:dark:hx-border-neutral-400">
{{- if site.Params.editURL.enable -}} {{ partial "components/edit-url.html" (dict "source" "toc" "context" .) }}
{{- $editURL := site.Params.editURL.base | default "" -}}
{{- with .Params.editURL -}}
{{/* if `editURL` is set in the front matter */}}
{{- $editURL = . -}}
{{- else -}}
{{- with .File -}}
{{/* `.FileInfo.Meta.SourceRoot` is a Hugo internal field, e.g. `/path/to/repo/content/en/` */}}
{{- $sourceDir := replace (strings.TrimPrefix .FileInfo.Meta.BaseDir .FileInfo.Meta.SourceRoot) "\\" "/" -}}
{{- $sourceDir = strings.TrimPrefix "/content" $sourceDir -}}
{{- $path := replace .Path "\\" "/" -}}
{{- $editURL = urls.JoinPath $editURL $sourceDir $path -}}
{{- end -}}
{{- end -}}
<a class="hx-text-xs hx-font-medium hx-text-gray-500 hover:hx-text-gray-900 dark:hx-text-gray-400 dark:hover:hx-text-gray-100 contrast-more:hx-text-gray-800 contrast-more:dark:hx-text-gray-50" href="{{ $editURL }}" target="_blank" rel="noreferer">{{ $editThisPage }}</a>
{{- end -}}
{{/* Scroll To Top */}} {{/* Scroll To Top */}}
<button aria-hidden="true" id="backToTop" onClick="scrollUp();" class="hx-transition-all hx-duration-75 hx-opacity-0 hx-text-xs hx-font-medium hx-text-gray-500 hover:hx-text-gray-900 dark:hx-text-gray-400 dark:hover:hx-text-gray-100 contrast-more:hx-text-gray-800 contrast-more:dark:hx-text-gray-50"> <button aria-hidden="true" id="backToTop" onClick="scrollUp();" class="hx-transition-all hx-duration-75 hx-opacity-0 hx-text-xs hx-font-medium hx-text-gray-500 hover:hx-text-gray-900 dark:hx-text-gray-400 dark:hover:hx-text-gray-100 contrast-more:hx-text-gray-800 contrast-more:dark:hx-text-gray-50">
<span> <span>