feat: add patchs for theme override

This commit is contained in:
Hugo Poissonnet 2022-12-21 23:27:35 +01:00
parent 87d86e7f4e
commit 84baa1d098
3 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,28 @@
--- themes/cupper-hugo-theme/layouts/_default/list.html 2022-12-05 19:56:43.667815118 +0100
+++ themes/cupper-hugo-theme/layouts/_default/list.html 2022-12-18 17:11:11.846547314 +0100
@@ -27,6 +27,25 @@
</h2>
</li>
{{ end }}
+ {{ if (eq .Type "post") }}
+ {{ range $.Site.Data.LegacyBlogUrls }}
+ <li>
+ <h2>
+ <a href="{{ .url }}">
+ <svg
+ class="bookmark"
+ aria-hidden="true"
+ viewBox="0 0 40 50"
+ focusable="false"
+ >
+ <use href="#bookmark"></use>
+ </svg>
+ {{ .metas.title }}
+ </a>
+ </h2>
+ </li>
+ {{ end }}
+ {{ end }}
</ul>
</main>
{{ end }}

View File

@ -0,0 +1,19 @@
--- themes/cupper-hugo-theme/layouts/partials/nav.html 2022-12-05 19:58:23.175031691 +0100
+++ themes/cupper-hugo-theme/layouts/partials/nav.html 2022-12-08 13:03:13.995570393 +0100
@@ -11,8 +11,7 @@
{{ range .Site.Menus.nav }}
<li class="pattern">
{{ $active := or ($current.IsMenuCurrent "nav" .) ($current.HasMenuCurrent "nav" .) }}
- {{ $active = or $active (eq .Name $current.Title) }}
- {{ $active = or $active (and (eq .Name "Blog") (eq $current.Section "post")) }}
+ {{ $active = or $active (eq .URL $current.RelPermalink) }}
{{ $active = or $active (and (eq .Name "Tags") (eq $current.Section "tags")) }}
<a href="{{ .URL }}" {{ if $active }}aria-current="page"{{ end }}>
<svg class="bookmark-icon" aria-hidden="true" focusable="false" viewBox="0 0 40 50">
@@ -23,4 +22,4 @@
</li>
{{ end }}
</ul>
-</nav>
\ No newline at end of file
+</nav>

4
v2/patching.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
git submodule update --recursive --remote
patch -p0 < add-posts-links-left-menu.patch --output=layouts/partials/nav.html
patch -p0 < add-legacy-urls-to-posts-list.patch --output=layouts/_default/list.html