Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mattstratton/castanet.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Stratton <matt.stratton@gmail.com>2019-11-30 02:10:13 +0300
committerGitHub <noreply@github.com>2019-11-30 02:10:13 +0300
commit0eab44470ce71e010ef79b20161cfd24e2316ce8 (patch)
tree96a7b8b29f9ed5dfd4421c1859041cb8aa520cf4
parent3b573a1642de1ee09391ed04f6d5934ff10df8e7 (diff)
Consolidate social partial (#237)
-rw-r--r--layouts/partials/head.html2
-rw-r--r--layouts/partials/head/seo.html4
-rw-r--r--layouts/partials/head/seo/google_news.html4
-rw-r--r--layouts/partials/head/seo/open_graph.html61
-rw-r--r--layouts/partials/head/seo/schema.html19
-rw-r--r--layouts/partials/head/seo/twitter_cards.html21
-rw-r--r--layouts/partials/seo.html55
7 files changed, 56 insertions, 110 deletions
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 6354fc2..3d5bd30 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -1,5 +1,5 @@
{{ partial "meta.html" . }}
-{{ partial "head/seo.html" . }}
+{{ partial "seo.html" . }}
<title>
{{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }}
{{ if eq $url "/" }}
diff --git a/layouts/partials/head/seo.html b/layouts/partials/head/seo.html
deleted file mode 100644
index 30882ac..0000000
--- a/layouts/partials/head/seo.html
+++ /dev/null
@@ -1,4 +0,0 @@
-{{ partial "head/seo/open_graph.html" . }}
-{{ partial "head/seo/schema.html" . }}
-{{ partial "head/seo/twitter_cards.html" . }}
-{{ partial "head/seo/google_news.html" . }} \ No newline at end of file
diff --git a/layouts/partials/head/seo/google_news.html b/layouts/partials/head/seo/google_news.html
deleted file mode 100644
index f6ba602..0000000
--- a/layouts/partials/head/seo/google_news.html
+++ /dev/null
@@ -1,4 +0,0 @@
-<!-- Output news_keywords taxonomy as Google news_keywords -->
-{{ with .Params.news_keywords }}
- <meta name="news_keywords" content="{{ range $i, $kw := first 10 . }}{{ if $i }},{{ end }}{{ $kw }}{{ end }}" />
-{{ end }} \ No newline at end of file
diff --git a/layouts/partials/head/seo/open_graph.html b/layouts/partials/head/seo/open_graph.html
deleted file mode 100644
index e8ab858..0000000
--- a/layouts/partials/head/seo/open_graph.html
+++ /dev/null
@@ -1,61 +0,0 @@
-<!-- Required Open Graph Info -->
-<meta property="og:title" content="{{ title .Title }}" />
-<meta property="og:description" content="{{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}" />
-<meta property="og:type" content="{{ if .Params.type }}{{ .Params.type }}{{ else }}website{{ end }}" />
-<meta property="og:url" content="{{ .Permalink }}" />
-{{ with .Params.images }}{{ range first 1 . }}
- {{ if (eq (slicestr . 0 4) "http") }}
- <meta property="og:image" content="{{ . }}" file= {{ slicestr . 0 4 }}/>
- {{ else }}
- <meta property="og:image" content="{{ $.Site.BaseURL}}{{ . }}" />
- {{ end }}
-{{ end }}{{ end }}
-
-<!-- Optional Open Graph Markup -->
-<meta property="og:updated_time" content="{{ .Date }}"/>
-{{ with .Params.audio }}<meta property="og:audio" content="{{ . }}" />{{ end }}
-{{ with .Params.locale }}<meta property="og:locale" content="{{ . }}" />{{ end }}
-{{ with .Site.Params.title }}<meta property="og:site_name" content="{{ . }}" />{{ end }}
-{{ with .Params.videos }}{{ range . }}
- <meta property="og:video" content="{{ . }}" />
-{{ end }}{{ end }}
-
-<!-- If it is part of a series, link to related articles -->
-{{ $permalink := .Permalink }}
-{{ $siteSeries := .Site.Taxonomies.series }}
-{{ with .Params.series }}{{ range $name := . }}
- {{ $series := index $siteSeries $name }}
- {{ range $page := first 6 $series.Pages }}
- {{ if ne $page.Permalink $permalink }}<meta property="og:see_also" content="{{ $page.Permalink }}" />{{ end }}
- {{ end }}
-{{ end }}{{ end }}
-
-{{ if and (isset .Site.Params "authors") (isset .Params "author") }}
-<!-- Article Specific Open Graph Markup -->
-{{ $author := index .Site.Params.authors .Params.author }}
-<meta property="article:author" content="https://www.facebook.com/{{ $author.social.facebook }}" />
-{{ end }}
-<meta property="article:publisher" content="https://www.facebook.com/{{ .Site.Params.social.facebook }}" />
-{{if .IsPage}}
- {{ if isset .Params "PublishDate" }}
- {{ if ne .PublishDate "" }}
- <meta property="article:published_time" content="{{ .PublishDate }}" />
- {{ else }}
- <meta property="article:published_time" content="{{ .Date }}" />
- {{ end }}
- {{ else }}
- <meta property="article:published_time" content="{{ .Date }}" />
- {{ end }}
-{{ end }}
-<meta property="article:modified_time" content="{{ .Date }}" />
-<meta property="article:section" content="{{ .Section }}" />
-{{ with .Params.tags }}{{ range first 6 . }}
- <meta property="article:tag" content="{{ . }}" />
-{{ end }}{{ end }}
-
-<!-- Facebook Page Admin ID for Domain Insights -->
-{{ with .Site.Params.social.facebook_admin }}
- {{ range . }}
- <meta property="fb:admins" content="{{ . }}" />
- {{ end }}
-{{ end }}
diff --git a/layouts/partials/head/seo/schema.html b/layouts/partials/head/seo/schema.html
deleted file mode 100644
index f87431e..0000000
--- a/layouts/partials/head/seo/schema.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!-- Schema.org markup -->
-<meta itemprop="name" content="{{ .Title }}">
-<meta itemprop="description" content="{{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}">
-
-<!-- Output images -->
-{{ with .Params.images }}{{ range first 6 . }}
- {{ if (eq (slicestr . 0 4) "http") }}
- <meta itemprop="image" content="{{ . }}">
- {{ else }}
- <meta itemprop="image" content="{{ $.Site.BaseURL}}{{ . }}">
- {{ end }}
-{{ end }}{{ end }}
-
-<!-- Output all taxonomies as schema.org keywords -->
-<meta itemprop="keywords" content="{{ range $plural, $terms := .Site.Taxonomies }}{{ range $term, $val := $terms }}{{ printf "%s," $term }}{{ end }}{{ end }}" />
-
-{{if .IsPage}}
-<meta itemprop="wordCount" content="{{ .WordCount }}">
-{{ end }}
diff --git a/layouts/partials/head/seo/twitter_cards.html b/layouts/partials/head/seo/twitter_cards.html
deleted file mode 100644
index 4aa7927..0000000
--- a/layouts/partials/head/seo/twitter_cards.html
+++ /dev/null
@@ -1,21 +0,0 @@
-{{ with .Params.images }}
-<!-- Twitter summary card with large image must be at least 280x150px -->
- <meta name="twitter:card" content="summary_large_image"/>
- {{ if (eq (slicestr (index . 0) 0 4) "http") }}
- <meta name="twitter:image:src" content="{{ index . 0 }}"/>
- {{ else }}
- <meta name="twitter:image:src" content="{{ $.Site.BaseURL}}{{ index . 0 }}"/>
- {{ end }}
-{{ else }}
- <meta name="twitter:card" content="summary"/>
-{{ end }}
-
-<!-- Twitter Card data -->
-<meta name="twitter:title" content="{{ .Title }}"/>
-<meta name="twitter:description" content="{{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}"/>
-{{ with .Site.Params.social.twitter }}<meta name="twitter:site" content="@{{ . }}"/>{{ end }}
-{{ with .Site.Params.social.twitter_domain }}<meta name="twitter:domain" content="{{ . }}"/>{{ end }}
-{{ if isset .Params "author" }}
- {{ $author := index .Site.Params.authors .Params.author }}
- {{ with $author.twitter }}<meta name="twitter:creator" content="@{{ $author.twitter }}"/>{{ end }}
-{{ end }}
diff --git a/layouts/partials/seo.html b/layouts/partials/seo.html
new file mode 100644
index 0000000..053f77e
--- /dev/null
+++ b/layouts/partials/seo.html
@@ -0,0 +1,55 @@
+<meta property="og:title" content="{{ title .Title }}" />
+<meta name="twitter:title" content="{{ .Title }}"/>
+<meta itemprop="name" content="{{ .Title }}">
+<meta property="article:modified_time" content="{{ .Date }}" />
+
+
+{{- with .Site.Params.title -}}<meta property="og:site_name" content="{{ . }}" />{{- end -}}
+{{- with .Params.locale -}}<meta property="og:locale" content="{{ . }}" />{{- end -}}
+
+
+
+{{- if .IsHome -}}
+ {{ with .Site.Params.feed.itunes_summary -}}
+ <meta property="og:description" content="{{ . }}" />
+ <meta name="twitter:description" content="{{ . }}" />
+ <meta itemprop="description" content="{{ . }}" />
+ {{- else -}}
+ <meta property="og:description" content="{{ $.Site.Title }}" />
+ <meta name="twitter:description" content="{{ $.Site.Title }}" />
+ <meta itemprop="description" content="{{ $.Site.Title }}" />
+ {{- end -}}
+{{- else -}}
+ <meta property="og:description" content="{{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}" />
+ <meta name="twitter:description" content="{{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}" />
+ <meta itemprop="description" content="{{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}">
+{{- end -}}
+
+{{ with .Site.Params.social.twitter }}<meta name="twitter:site" content="@{{ . }}"/>{{ end }}
+{{ with .Site.Params.social.twitter }}<meta name="twitter:creator" content="@{{ . }}"/>{{ end }}
+{{ with .Site.Params.social.twitter_domain }}<meta name="twitter:domain" content="{{ . }}"/>{{ end }}
+<meta property="og:type" content="{{ if .Params.type }}{{ .Params.type }}{{ else }}website{{ end }}" />
+
+<meta property="og:url" content="{{ .Permalink | relURL }}" />
+
+{{ with .Params.images }}{{ range first 1 . }}
+ <meta name="twitter:card" content="summary_large_image" />
+ {{ if (eq (slicestr . 0 4) "http") }}
+ <meta property="og:image" content="{{ . }}"/>
+ <meta name="twitter:image" content="{{ . }}" />
+ <meta itemprop="image" content="{{ . }}" />
+ {{ else }}
+ <meta property="og:image" content="{{ $.Site.BaseURL}}/{{ . }}" />
+ <meta name="twitter:image" content="{{ $.Site.BaseURL}}/{{ . }}"/>
+ <meta itemprop="image" content="{{ $.Site.BaseURL}}/{{ . }}" />
+ {{ end }}
+{{ end }}{{ end }}
+
+
+
+<!-- Facebook Page Admin ID for Domain Insights -->
+{{ with .Site.Params.social.facebook_admin }}
+ {{ range . }}
+ <meta property="fb:admins" content="{{ . }}" />
+ {{ end }}
+{{ end }}