Skip to content

Commit

Permalink
update partials
Browse files Browse the repository at this point in the history
  • Loading branch information
HidegonSan committed Nov 13, 2023
1 parent d2ad221 commit b4152d1
Show file tree
Hide file tree
Showing 15 changed files with 94 additions and 87 deletions.
7 changes: 7 additions & 0 deletions layouts/partials/anti_adblock.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{/* 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>
*/}}
7 changes: 7 additions & 0 deletions layouts/partials/chroma_noscript.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{/* chroma css for noscript */}}

<noscript>
{{- with resources.Get "css/chroma_noscript.css" | toCSS | minify | fingerprint -}}
<link rel="stylesheet" href="{{- .RelPermalink -}}" integrity="{{- .Data.Integrity -}}" crossorigin="anonymous" rel="preload stylesheet" as="style">
{{- end -}}
</noscript>
7 changes: 1 addition & 6 deletions layouts/partials/extend_footer.html
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
<!-- instant.page | Thanks: https://instant.page/ -->
{{ with resources.Get "js/instantpage.min.js" | js.Build }}
<script>
{{ .Content | safeJS }}
</script>
{{ end }}
{{- partial "instant_page.html" . -}}
51 changes: 4 additions & 47 deletions layouts/partials/extend_head.html
Original file line number Diff line number Diff line change
@@ -1,50 +1,7 @@
{{- if site.Params.classification -}}
{{ with site.Params.classification }}
<meta name="classification" content="{{- range $i, $e := . }}{{ if $i }}, {{ end }}{{ $e }}{{ end }}">
{{ end }}
{{- end }}
{{- partial "seo.html" . -}}

{{- partial "anti_adblock.html" . -}}

{{/* 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">
{{- partial "pwa.html" . -}}


{{/* 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">


<noscript>
{{ with resources.Get "css/chroma_noscript.css" | toCSS | minify | fingerprint }}
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous" rel="preload stylesheet" as="style">
{{ end }}
</noscript>
{{- partial "chroma_noscript.html" . -}}
1 change: 0 additions & 1 deletion layouts/partials/extend_header.html
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<!-- Magnific Image Pop-Up Modal for Hugo | Thanks: https://gist.github.com/zjeaton/0cdd7e4bed9d292ab6f3d76b0369f16d -->
{{- partial "image_modal.html" . -}}
21 changes: 11 additions & 10 deletions layouts/partials/extend_post_meta.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{{/* 公開日関連 | Thanks: https://aloha-ru.com/hugo/hugo-dateupdate/ */}}

{{/* 公開日と更新日を変数に格納する */}}
{{ $date := .Date.Format "2006-01-02" }}
{{ $lastmod := .Lastmod.Format "2006-01-02" }}
{{- $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 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 }}
<time itemprop="dateModified" datetime="{{- .Lastmod -}}">&nbsp;|&nbsp;更新: {{- .Lastmod.Format "2006-01-02" -}}</time>
{{- end -}}
{{/* 公開日と更新日が同じ場合、公開日のみ表示 */}}
{{ else }}
{{- else -}}
{{- if not .Date.IsZero -}}
<time itemprop="datePublished" datetime="{{ .Date }}">公開: {{ .Date.Format "2006-01-02" }}</time>
{{ end }}
{{ end }}
<time itemprop="datePublished" datetime="{{- .Date -}}">公開: {{- .Date.Format "2006-01-02" -}}</time>
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion layouts/partials/hamburger_menu.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Thanks: https://github.com/Wonderfall/hugo-WonderMod/ -->
{{/* Thanks: https://github.com/Wonderfall/hugo-WonderMod/ */}}

<input id="hamburger_menu_input" type="checkbox"></input>
<label id="hamburger_menu_menu" for="hamburger_menu_input"></label>
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
</div>
{{- $currentPage := . }}

<!-- Added by Hidegon -->
{{/* Added by Hidegon */}}
{{/* {{- partial "hamburger_menu.html" . -}} */}}

<ul id="menu">
Expand Down
13 changes: 7 additions & 6 deletions layouts/partials/image_modal.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<!-- Magnific Image Pop-Up Modal for Hugo | Thanks: https://gist.github.com/zjeaton/0cdd7e4bed9d292ab6f3d76b0369f16d -->
{{/*

Magnific Image Pop-Up Modal for Hugo | Thanks: https://gist.github.com/zjeaton/0cdd7e4bed9d292ab6f3d76b0369f16d

<!-- Place in layouts > partials > image-modal.html -->
<!-- Use the partial at the bottom of any page in which you want magnific pop-up images,
or simply place at the bottom of baseof.html -->
<!-- Modal will open upon clicking the image. Modal will close with clicking the x or image. -->
Place in layouts > partials > image-modal.html
Use the partial at the bottom of any page in which you want magnific pop-up images, or simply place at the bottom of baseof.html
Modal will open upon clicking the image. Modal will close with clicking the x or image.

*/}}

<!-- The Modal -->
<div id="image_modal" class="image_modal" onclick="close_image_modal()">
<button class="image_modal_close" onclick="close_image_modal()">close</button>
<div class="image_modal_content" onclick="close_image_modal()">
Expand Down
7 changes: 7 additions & 0 deletions layouts/partials/instant_page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{/* instant.page | Thanks: https://instant.page/ */}}

{{- with resources.Get "js/instantpage.min.js" | js.Build | minify -}}
<script>
{{- .Content | safeJS -}}
</script>
{{- end -}}
2 changes: 1 addition & 1 deletion layouts/partials/pagination.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{/* Thanks: https://joni.jp/pg/hugo-pagination/ */}}
{{/* <nav>
{{ template "_internal/pagination.html" . }}
{{- template "_internal/pagination.html" . -}}
</nav> */}}

{{/* /tpl/tplimpl/embedded/templates/pagination.html */}}
Expand Down
9 changes: 9 additions & 0 deletions layouts/partials/pwa.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{/* PWA | Thanks: https://aloha-ru.com/hugo/pwa-hugo/ */}}

<script>
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("/blog/sw.js")
}
</script>

<link rel="manifest" href="/manifest.json">
26 changes: 13 additions & 13 deletions layouts/partials/related_posts.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{{/* Show related posts | Thanks: https://github.com/adityatelange/hugo-PaperMod/pull/1049 */}}

{{ $related := first 4 (where (where .Site.Pages ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }}
{{ with $related }}
<div class="related">
<h3 class="see-also">関連記事</h3>
<ul>
{{ range . }}
<li>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</li>
{{ end }}
</ul>
</div>
{{ end }}
{{- $related := first 4 (where (where .Site.Pages ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) -}}
{{- with $related -}}
<div class="related">
<h3 class="see-also">関連記事</h3>
<ul>
{{- range . -}}
<li>
<a href="{{- .RelPermalink -}}">{{- .Title -}}</a>
</li>
{{- end -}}
</ul>
</div>
{{- end -}}
2 changes: 1 addition & 1 deletion layouts/partials/search_noscript.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Thanks: https://github.com/Wonderfall/hugo-WonderMod -->
{{/* Thanks: https://github.com/Wonderfall/hugo-WonderMod */}}

<noscript>
<style>
Expand Down
24 changes: 24 additions & 0 deletions layouts/partials/seo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{/* Added for SEO */}}

{{- if site.Params.classification -}}
{{- with site.Params.classification -}}
<meta name="classification" content="{{- range $i, $e := . -}}{{- if $i -}}, {{- end -}}{{- $e -}}{{- end -}}">
{{- end -}}
{{- end }}

{{- $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">

0 comments on commit b4152d1

Please sign in to comment.