main
html 50 lines 2.48 KB
Raw
1 {{- $title := cond .IsHome .Site.Title (printf "%s | %s" .Title .Site.Title) -}}
2 {{- $siteDescription := .Site.Params.description | default "Claracle turns GitHub activity into weekly tech trend analysis for developers and tech leads." -}}
3 {{- $description := .Description | default .Summary | default $siteDescription | plainify | htmlUnescape | chomp -}}
4 {{- $description = $description | truncate 155 -}}
5 {{- $defaultImage := .Site.Params.default_social_image | default "/images/squadscope-social-card.png" -}}
6 {{- /* Placeholder social card path: Calculon will provide the 1200×630 image asset separately. */ -}}
7 {{- $imageParam := .Params.featured_image | default $defaultImage -}}
8 {{- $image := $imageParam -}}
9 {{- if not (or (hasPrefix $imageParam "http://") (hasPrefix $imageParam "https://")) -}}
10 {{- $image = (strings.TrimPrefix "/" $imageParam) | absURL -}}
11 {{- end -}}
12 {{- $publisherLogo := $defaultImage -}}
13 {{- if not (or (hasPrefix $publisherLogo "http://") (hasPrefix $publisherLogo "https://")) -}}
14 {{- $publisherLogo = (strings.TrimPrefix "/" $publisherLogo) | absURL -}}
15 {{- end -}}
16 {{- $isArticle := or (and .IsPage (eq .Section "weekly")) (eq .Type "topics") -}}
17 {{- $type := cond $isArticle "article" "website" -}}
18
19 <title>{{ $title }}</title>
20 <meta name="description" content="{{ $description }}">
21 <meta name="author" content="{{ .Site.Params.author | default "Claracle" }}">
22 <link rel="canonical" href="{{ .Permalink }}">
23
24 <meta property="og:title" content="{{ $title }}">
25 <meta property="og:description" content="{{ $description }}">
26 <meta property="og:image" content="{{ $image }}">
27 <meta property="og:url" content="{{ .Permalink }}">
28 <meta property="og:type" content="{{ $type }}">
29 <meta property="og:site_name" content="{{ .Site.Title }}">
30
31 <meta name="twitter:card" content="summary_large_image">
32 <meta name="twitter:title" content="{{ $title }}">
33 <meta name="twitter:description" content="{{ $description }}">
34 <meta name="twitter:image" content="{{ $image }}">
35
36 {{- if $isArticle }}
37 {{- $publisher := dict "@type" "Organization" "name" "Claracle" "logo" (dict "@type" "ImageObject" "url" $publisherLogo) -}}
38 {{- $schema := dict
39 "@context" "https://schema.org"
40 "@type" "Article"
41 "headline" .Title
42 "description" $description
43 "image" $image
44 "url" .Permalink
45 "datePublished" (.Date.Format "2006-01-02T15:04:05Z07:00")
46 "author" (dict "@type" "Organization" "name" "Claracle")
47 "publisher" $publisher
48 -}}
49 <script type="application/ld+json">{{ $schema | jsonify | safeJS }}</script>
50 {{- end }}