Skip to content

Commit

Permalink
Merge pull request #1124 from arunoruto/main
Browse files Browse the repository at this point in the history
Fix annoying `.File.Path on zero object.` warning
  • Loading branch information
nunocoracao authored Dec 18, 2023
2 parents b6744ef + 844cf98 commit 6611e0f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ <h1 class="mt-5 text-4xl font-extrabold text-neutral-900 dark:text-neutral">{{ .
<div class="mt-1 mb-2 text-base text-neutral-500 dark:text-neutral-400 print:hidden">
{{ partial "article-meta/list.html" (dict "context" . "scope" "single") }}
</div>
{{ with .File }}
<script>
var oid = "views_{{ .File.Path }}"
var oid_likes = "likes_{{ .File.Path }}"
var oid = "views_{{ .Path }}"
var oid_likes = "likes_{{ .Path }}"
</script>
{{ end }}
{{ $jsPage := resources.Get "js/page.js" }}
{{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }}
<script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}"></script>
Expand Down
6 changes: 4 additions & 2 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,12 @@ <h1 class="mt-0 text-4xl font-extrabold text-neutral-900 dark:text-neutral">
{{ partial "related.html" . }}
</div>

{{ with .File }}
<script>
var oid = "views_{{ .File.Path }}"
var oid_likes = "likes_{{ .File.Path }}"
var oid = "views_{{ .Path }}"
var oid_likes = "likes_{{ .Path }}"
</script>
{{ end }}
{{ $jsPage := resources.Get "js/page.js" }}
{{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }}
<script type="text/javascript" src="{{ $jsPage.RelPermalink }}" integrity="{{ $jsPage.Data.Integrity }}"></script>
Expand Down

0 comments on commit 6611e0f

Please sign in to comment.