Skip to content

Commit

Permalink
refactor: use extend files
Browse files Browse the repository at this point in the history
  • Loading branch information
HidegonSan committed Aug 13, 2023
1 parent 49047b8 commit c21987d
Show file tree
Hide file tree
Showing 11 changed files with 232 additions and 267 deletions.
35 changes: 0 additions & 35 deletions layouts/_default/baseof.html

This file was deleted.

9 changes: 7 additions & 2 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ <h2>
{{- if gt $paginator.TotalPages 1 }}
<footer class="page-footer">

{{/* <nav class="pagination">

{{/*
<nav class="pagination">

{{- if $paginator.HasPrev }}
<a class="prev" href="{{ $paginator.Prev.URL | absURL }}">
«&nbsp;{{ i18n "prev_page" }}&nbsp;
Expand All @@ -106,8 +109,10 @@ <h2>
{{- end }}&nbsp;»
</a>
{{- end }}
</nav> */}}
</nav>
*/}}

{{/* Added by Hidegon */}}
{{/* Thanks: https://joni.jp/pg/hugo-pagination/ */}}
{{- partial "pagination.html" . -}}

Expand Down
4 changes: 3 additions & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ <h1 class="post-title">
{{- end }}

<footer class="post-footer">

{{/* Added by Hidegon */}}
{{/* Show related posts | Thanks: https://github.com/adityatelange/hugo-PaperMod/pull/1049 */}}
{{- if (.Param "ShowRelatedContent") }}
{{- partial "related.html" . }}
{{- partial "related_posts.html" . }}
{{- end }}

{{- if (.Param "tags")}}
Expand Down
6 changes: 6 additions & 0 deletions layouts/partials/extend_footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!-- instant.page | Thanks: https://instant.page/ -->
{{ with resources.Get "js/instantpage.min.js" | js.Build }}
<script>
{{ .Content | safeJS }}
</script>
{{ end }}
43 changes: 43 additions & 0 deletions layouts/partials/extend_head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{- if site.Params.classification -}}
{{ with site.Params.classification }}
<meta name="classification" content="{{- range $i, $e := . }}{{ if $i }}, {{ end }}{{ $e }}{{ end }}">
{{ end }}
{{- end }}


{{/* Added for SEO */}}
{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
{{ with .PublishDate }}<meta name="creation_date" content="{{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }}" />{{ end }}
<meta name="coverage" content="japan" />
<meta name="content-language" content="ja" />
<link title="Search" href="{{ absURL "search/" }}" rel="search" />
<link title="Terms" href="{{ absURL "pages/terms/"}}" rel="copyright" />
<meta http-equiv="Content-Language" content="ja">
<meta name="HandheldFriendly" content="true" />
<meta name="MobileOptimized" content="320">
<meta name="format-detection" content="telephone=no" />
<meta name="robots" content="max-image-preview:large">
<link rel="preconnect dns-prefetch" href="//www.googletagmanager.com">
<link rel="preconnect dns-prefetch" href="//www.google-analytics.com">


{{/* Anti Ad Block */}}
{{/*
<script>
if(true)!function(){fetch("https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js").then().catch(()=>{var d=document;d.open();d.write("<style>body{background:black;user-select:none;color:red;text-align:center;font-weight:bold;font-family:monospace;}</style><p style='font-size:calc(100vw/10);'>AD BLOCKER DETECTED</p><p style='font-size:calc(100vw/12)'>DISABLE YOUR AD BLOCKER</p>");d.close();d.title="AD BLOCKER DETECTED";})}();
</script>
*/}}
{{/* End of Anti Ad Block */}}


{{/* PWA | Thanks: https://aloha-ru.com/hugo/pwa-hugo/ */}}
<script>
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("/blog/sw.js")
}
</script>
{{/* End of PWA */}}


{{/* PWA | Thanks: https://aloha-ru.com/hugo/pwa-hugo/ */}}
<link rel="manifest" href="/manifest.json">
2 changes: 2 additions & 0 deletions layouts/partials/extend_header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!-- Magnific Image Pop-Up Modal for Hugo | Thanks: https://gist.github.com/zjeaton/0cdd7e4bed9d292ab6f3d76b0369f16d -->
{{- partial "image_modal.html" . -}}
17 changes: 17 additions & 0 deletions layouts/partials/extend_post_meta.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{/* 公開日関連 | Thanks: https://aloha-ru.com/hugo/hugo-dateupdate/ */}}
{{/* 公開日と更新日を変数に格納する */}}
{{ $date := .Date.Format "2006-01-02" }}
{{ $lastmod := .Lastmod.Format "2006-01-02" }}

{{/* 公開日と更新日が違う場合、両方を表示 */}}
{{ if and (ne $lastmod $date) }}
<time itemprop="datePublished" datetime="{{ .Date }}">公開: {{ .Date.Format "2006-01-02" }}</time>
{{- if not .Lastmod.IsZero -}}
<time itemprop="dateModified" datetime="{{ .Lastmod }}">&nbsp;|&nbsp;更新: {{ .Lastmod.Format "2006-01-02" }}</time>
{{ end }}
{{/* 公開日と更新日が同じ場合、公開日のみ表示 */}}
{{ else }}
{{- if not .Date.IsZero -}}
<time itemprop="datePublished" datetime="{{ .Date }}">公開: {{ .Date.Format "2006-01-02" }}</time>
{{ end }}
{{ end }}
212 changes: 0 additions & 212 deletions layouts/partials/head.html

This file was deleted.

Loading

0 comments on commit c21987d

Please sign in to comment.