Skip to content

Commit

Permalink
Copy paper theme's head.html, add plausible script tag
Browse files Browse the repository at this point in the history
  • Loading branch information
canxerian committed Jul 17, 2024
1 parent f7b0571 commit 49402c1
Showing 1 changed file with 109 additions and 0 deletions.
109 changes: 109 additions & 0 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{{/* Copied and modified version of themes/paper/layouts/partials/head.html */}}
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>

<!-- Title -->
<title>{{ if not .IsHome }}{{ .Title }} - {{ end }}{{ site.Title }}</title>

<!-- Meta -->
<meta name="theme-color" />

<!-- Author -->
{{ $site_author := or site.Author.name site.Params.name site.Title }}
<!---->
{{ if eq .Kind "page" }}
<meta name="description" content="{{ .Summary }}" />
<meta name="author" content="{{ or .Params.author $site_author }}" />
{{ else }}
<!---->
<meta
name="description"
content="{{ site.Params.description | default (print `A personal blog`) }}"
/>
<meta name="author" content="{{ $site_author }}" />
{{ end }}

<!-- CSS & JS -->
{{ $main := resources.Get "main.css" }}
<!---->
{{ $custom := resources.Get "custom.css" }}
<!---->
{{ $css := slice $main $custom | resources.Concat "main.css" | minify }}
<link rel="preload stylesheet" as="style" href="{{ $css.Permalink }}" />

<!-- Dark Icon -->
{{ $dark_icon := "theme.png" }}
<!---->
{{ if site.Params.monoDarkIcon }}{{ $dark_icon = "theme.svg" }}{{ end }}
<!---->
<link rel="preload" as="image" href="{{ $dark_icon | absURL }}" />

<!-- Avatar -->
{{ $avatar_url := $.Scratch.Get "avatar_url" }}
<!---->
{{ if $avatar_url }}
<link rel="preload" as="image" href="{{ $avatar_url }}" />
{{ end }}
<!---->

<!-- Social List -->
{{ range $.Scratch.Get "social_list" }}
<link rel="preload" as="image" href="{{ printf `%s.svg` . | absURL }}" />
{{ end }}
<!---->

<!-- Highlight JS -->
{{ if and .IsPage (not site.Params.disableHLJS) }}
<script
defer
src="{{ `highlight.min.js` | absURL }}"
onload="hljs.initHighlightingOnLoad();"
></script>
{{ end }}

<!-- Math -->
{{ if or .Params.math site.Params.math }}
<!---->
{{ partial "math.html" . }}
<!---->
{{ end }}
<!---->

<!-- Favicon -->
<link rel="icon" href="{{ site.Params.favicon | default `favicon.ico` | absURL }}" />
<link rel="apple-touch-icon" href="{{ site.Params.appleTouchIcon | default `apple-touch-icon.png` | absURL }}" />

<!-- Generator -->
{{ hugo.Generator }}

<!-- Production -->
{{ if or hugo.IsProduction (eq site.Params.env "production") }}
<!---->
{{ template "_internal/google_analytics.html" . }}
<!---->
{{ template "_internal/schema.html" . }}
<!---->
{{ template "_internal/opengraph.html" . }}
<!---->
{{ template "_internal/twitter_cards.html" . }}
<!-- RSS -->
{{ range .AlternativeOutputFormats }}
<link
rel="{{ .Rel }}"
type="{{ .MediaType.Type }}"
href="{{ .Permalink }}"
title="{{ site.Title }}"
/>
{{ end }}
<!-- Canonical -->
<link rel="canonical" href="{{ .Permalink }}" />
{{ end }}
<!---->

<script defer data-domain="canxerian.com" src="https://plausible.uksouth.cloudapp.azure.com/js/script.js"></script>
</head>

0 comments on commit 49402c1

Please sign in to comment.