Skip to content

Commit

Permalink
fix: sticking html extension when using partial - close #5
Browse files Browse the repository at this point in the history
  • Loading branch information
tomowang committed Dec 14, 2023
1 parent 1eed981 commit 5067888
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,6 @@ you can use the following code.

```html
<i class="h-6 w-6 flex-none">
{{ partial "icon" "brightness-down" }}
{{ partial "icon.html" "brightness-down" }}
</i>
```
6 changes: 3 additions & 3 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ <h2 class="text-4xl font-semibold text-slate-800 dark:text-slate-200">
<a href="{{ .RelPermalink }}">{{ .Title | .RenderString }}</a>
</h2>

{{ partial "block/desc" . }}
{{ partial "block/taxonomies" .}}
{{ partial "block/desc.html" . }}
{{ partial "block/taxonomies.html" .}}

{{ partial "block/time" . }}
{{ partial "block/time.html" . }}
</article>
{{ end }}
</section>
Expand Down
8 changes: 4 additions & 4 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ <h1 class="text-4xl font-semibold text-slate-800 dark:text-slate-100">
<a href="{{ .RelPermalink }}">{{ .Title | .RenderString }}</a>
</h1>

{{ partial "block/desc" . }}
{{ partial "block/taxonomies" .}}
{{ partial "block/desc.html" . }}
{{ partial "block/taxonomies.html" .}}

{{ partial "block/time" . }}
{{ partial "block/time.html" . }}

{{ if or .Params.Toc $.Site.Params.Toc }}
{{ if ne .Params.Toc false }}
Expand All @@ -23,7 +23,7 @@ <h2>{{ T "table_of_contents" }}</h2>
{{ .Content | safeHTML }}
</article>

{{ partial "comments" . }}
{{ partial "comments.html" . }}
</div>
</div>
{{ end }}
2 changes: 1 addition & 1 deletion layouts/partials/block/sidebar_section.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="flex flex-row">
<a class="flex flex-row" href='{{ (site.GetPage $taxonomy).RelPermalink }}'>
<i class="h-6 w-6 flex-none">
{{ partial "icon" $icon }}
{{ partial "icon.html" $icon }}
</i>
<h2 class="pl-1 uppercase">
{{ T (printf "taxonomies.%s" $taxonomy) | safeHTML }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/block/taxonomies.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<a href="{{ (urlize (printf "tags/%s" . )) | relLangURL }}/"
class="flex flex-row text-sm mr-2 py-1">
<i class="h-5 w-5 flex-none">
{{ partial "icon" site.Params.taxonomies.icons.tags }}
{{ partial "icon.html" site.Params.taxonomies.icons.tags }}
</i>
<span class="ml-0">{{ . }}</span>
</a>
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/block/time.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{ $dateHuman := .Date.Format ($.Site.Params.DateFormatList | default "2006-01-02") }}
<div class="flex flex-row text-base gap-x-1">
<i class="h-6 w-6 flex-none">
{{ partial "icon" "calendar" }}
{{ partial "icon.html" "calendar" }}
</i>
<time datetime="{{ $dateMachine }}">
{{ $dateHuman }}
Expand All @@ -14,7 +14,7 @@
{{- if $.Site.Params.showReadingTime }}
<div class="flex flex-row text-base gap-x-1">
<i class="h-6 w-6 flex-none">
{{ partial "icon" "hourglass-high" }}
{{ partial "icon.html" "hourglass-high" }}
</i>
<span>
{{ T "reading_time" .ReadingTime }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<section class="flex flex-col md:flex-row mx-2 md:mx-0 gap-2 md:gap-0 justify-between w-full max-w-4xl lg:max-w-5xl py-6 text-slate-500 dark:text-slate-300">
<div class="flex flex-row">
{{ partial "social_media" . }}
{{ partial "social_media.html" . }}
</div>
<div class="grow"></div>
<div class="flex flex-row">
{{- $CopyrightSign := (printf `<i class="h-6 w-6 flex-none">%s</i>` (partial "icon" "copyright")) -}}
{{- $CopyrightSign := (printf `<i class="h-6 w-6 flex-none">%s</i>` (partial "icon.html" "copyright")) -}}
{{- $SinceYear := .Site.Params.footer.since -}}
{{- $CurrentYear := now.Format "2006" -}}
{{- $Copyright := .Site.Copyright -}}
Expand Down
6 changes: 3 additions & 3 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<button id="navbar-lang-toggle" type="button" class="inline-flex items-center p-2 text-sm text-slate-800 dark:text-slate-200 rounded-lg" aria-controls="navbar-menu" aria-expanded="false">
<span class="sr-only">{{ T "open_lang_switcher" }}</span>
<i class="w-8 h-8">
{{ partial "icon" "language" }}
{{ partial "icon.html" "language" }}
</i>
</button>
<div class="absolute hidden top-16 z-50" id="navbar-lang">
Expand All @@ -37,10 +37,10 @@
<input name="darkmode-toggle" id="darkmode-toggle" type="checkbox" class="sr-only peer" aria-label="{{ T "header.darkmode_toggle" }}">
<div class="group flex flex-row gap-1 justify-center h-8 px-1 rounded-full bg-white dark:bg-gray-700">
<i class="h-6 w-6 flex-none rounded-full bg-yellow-400 place-self-center peer-checked:group-[]:invisible">
{{ partial "icon" "brightness-down" }}
{{ partial "icon.html" "brightness-down" }}
</i>
<i class="h-6 w-6 flex-none rounded-full place-self-center invisible peer-checked:group-[]:visible">
{{ partial "icon" "moon-stars" }}
{{ partial "icon.html" "moon-stars" }}
</i>
</div>
</label>
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<button id="navbar-menu-toggle" type="button" class="inline-flex items-center p-2 text-sm text-slate-800 dark:text-slate-200 rounded-lg md:hidden" aria-controls="navbar-menu" aria-expanded="false">
<span class="sr-only">{{ T "open_main_menu" }}</span>
<i class="w-8 h-8">
{{ partial "icon" "menu-2" }}
{{ partial "icon.html" "menu-2" }}
</i>
</button>
<div class="absolute md:static top-16 left-0 right-0 z-50 hidden w-full md:block md:w-auto" id="navbar-menu">
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/pagination.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
{{ if .Paginator.HasPrev }}
<a href="{{ .Paginator.Prev.URL }}"
class="flex flex-row text-base font-semibold rounded-md text-slate-700 dark:text-slate-300 bg-slate-200 dark:bg-gray-700 p-2 pr-3">
<i class="h-6 w-6 flex-none mr-1">{{ partial "icon" "caret-left" }}</i>
<i class="h-6 w-6 flex-none mr-1">{{ partial "icon.html" "caret-left" }}</i>
<span>{{ T "paginator.newer_posts" }}</span>
</a>
{{ end }}
{{ if .Paginator.HasNext }}
<a href="{{ .Paginator.Next.URL }}"
class="flex flex-row text-base font-semibold rounded-md text-slate-700 dark:text-slate-300 bg-slate-200 dark:bg-gray-700 p-2 pl-3">
<span>{{ T "paginator.older_posts" }}</span>
<i class="h-6 w-6 flex-none ml-1">{{ partial "icon" "caret-right" }}</i>
<i class="h-6 w-6 flex-none ml-1">{{ partial "icon.html" "caret-right" }}</i>
</a>
{{ end }}
</div>
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/sidebar.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ range $taxonomy, $terms := site.Taxonomies }}
{{ if $terms }}
{{ partial "block/sidebar_section" (dict "Context" $terms "Taxonomy" $taxonomy "Limit" 10) }}
{{ partial "block/sidebar_section.html" (dict "Context" $terms "Taxonomy" $taxonomy "Limit" 10) }}
{{ end }}
{{ end }}
2 changes: 1 addition & 1 deletion layouts/partials/social_media.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{ if .enabled }}
<a href="{{ .link | safeURL | default "#" }}" target="_blank" title="{{ .title }}" class="flex flex-row mr-2">
<span class="hidden">{{ .title }}</span>
<i class="h-6 w-6 flex-none"> {{ partial "icon" .icon }} </i>
<i class="h-6 w-6 flex-none"> {{ partial "icon.html" .icon }} </i>
</a>
{{ end }}
{{ end }}
Expand Down

0 comments on commit 5067888

Please sign in to comment.