add tella theme

This commit is contained in:
2023-08-07 10:59:23 +02:00
parent 35bc0c2cac
commit e203dc7597
107 changed files with 4495 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
{{/*
Add/Edit SEO Scratch Object
@author The New Dynamic
@access public
@context Page
User does not load the partial, as the component will.
This allows to overwrite some SEO object keys with project's own.
Project's partial should live under `layouts/partials/seo/extend.html`
@example - In Partial
{{- if eq "Type" "recipe" -}}
{{- .Scratch.SetInMap "seo" "type" "article" -}}
{{- end -}}
{{- $locales := dict "fr" "fr_FR" "en" "en_US" -}}
{{- .Scratch.SetInMap "seo" "locale" (index $locales .Lang) -}}
{{- if .IsHome -}}
{{- .Scratch.SetInMap "seo" "title" "Welcome Home" -}}
{{- end -}}
*/}}

View File

@@ -0,0 +1,87 @@
{{- $.Scratch.Set "seo" dict -}}
{{/* 日付 */}}
{{- if not .PublishDate.IsZero -}}
{{- $.Scratch.SetInMap "seo" "published_time" (.PublishDate.Format "2006-01-02T15:04:05-07:00") -}}
{{- else if not .Date.IsZero -}}
{{- $.Scratch.SetInMap "seo" "published_time" (.Date.Format "2006-01-02T15:04:05-07:00") -}}
{{- end -}}
{{- if not .Lastmod.IsZero -}}
{{- $.Scratch.SetInMap "seo" "updated_time" (.Lastmod.Format "2006-01-02T15:04:05-07:00") -}}
{{- end -}}
{{/* 説明 */}}
{{ $description := "" }}
{{/* 1. SEO Description */}}
{{- if .Params.seo.description -}}
{{- $description = .Params.seo.description -}}
{{/* 2. Description
As it could potentially contain HTML tags, we strip them with plainify */}}
{{- else if .Params.description -}}
{{- $description = .Params.description | plainify -}}
{{/* 3. Summary */}}
{{- else if .Summary -}}
{{- $description = substr .Summary 0 60 | plainify -}}
{{- else -}}
{{/* 4. site description */}}
{{ $description = .Site.Params.Description }}
{{- end -}}
{{- $.Scratch.SetInMap "seo" "description" $description -}}
{{/* サイト名 */}}
{{- with .Param "seo.site_name" -}}
{{- $.Scratch.SetInMap "seo" "site_name" . -}}
{{- else -}}
{{- $.Scratch.SetInMap "seo" "site_name" .Site.Title -}}
{{- end -}}
{{/* Twitter */}}
{{/* Default twitter_card is "summary_large_image" */}}
{{- $.Scratch.SetInMap "seo" "twitter_card" "summary_large_image" -}}
{{/* We check the site config sports a Social.twitter and use as handle */}}
{{- with .Site.Social.twitter -}}
{{- $.Scratch.SetInMap "seo" "twitter_handle" (printf "@%s" .) -}}
{{- end -}}
{{/* 種類 */}}
{{- $.Scratch.SetInMap "seo" "type" "website" -}}
{{- if in (slice "blog" "news") .Type -}}
{{- $.Scratch.SetInMap "seo" "type" "article" -}}
{{ else if in (slice "article") .Type }}
{{- $.Scratch.SetInMap "seo" "type" "event" -}}
{{- end -}}
{{/* 言語 */}}
{{- $.Scratch.SetInMap "seo" "locale" "ja_JP" -}}
{{/* Canonical */}}
{{ with .Params.seo.canonical }}
{{- $.Scratch.SetInMap "seo" "canonical" (. | absURL) -}}
{{ else }}
{{- $.Scratch.SetInMap "seo" "canonical" .Permalink -}}
{{ end }}
{{- partial "seo/extend" . -}}
{{ partial "seo/tags" (dict "page" $ "seo" ($.Scratch.Get "seo")) }}
{{ with .Site.Params.seo.jsonld }}
{{ partial "seo/jsonld" (dict "page" $ "seo" ($.Scratch.Get "seo")) }}
{{ end }}
{{ with .Site.Params.seo.debug }}
{{ partial "seo/debug" $ }}
{{ end }}
{{ if .Params.image }}
{{ with .Params.image }}
<meta property="og:image" content="{{ . | absURL }}">
<meta property="og:image:url" content="{{ . | absURL }}">
{{ end }}
{{ else }}
<meta property="og:image" content="{{ .Site.Params.og_image | absURL }}">
<meta property="og:image:url" content="{{ .Site.Params.og_image | absURL }}">
{{ end }}

View File

@@ -0,0 +1,18 @@
{{- $seo := .seo -}}
<meta name="description" content="{{ $seo.description }}">
<meta property="og:title" content="{{ .Title }} | {{ .Site.Title }}" />
<meta property="og:site_name" content="{{ $seo.site_name }}">
<meta property="og:description" content="{{ $seo.description }}">
<meta property="og:url" content="{{ .page.Permalink }}">
<meta property="og:type" content="{{ $seo.type }}">
<meta property="og:locale" content="{{ $seo.locale }}">
<meta name="twitter:card" content="{{ $seo.twitter_card }}">
<meta name="twitter:site" content="@tech_chiba">
{{ with $seo.canonical }}
<link rel="canonical" href="{{ . }}">
{{ end }}
<meta name="twitter:description" content="{{- $seo.description }}">
<meta property="article:published_time" content="{{- $seo.published_time }}">
{{- with $seo.updated_time }}
<meta property="article:updated_time" content="{{- $seo.updated_time }}">
{{- end }}