Updates to SEO
This commit is contained in:
parent
5bbbd39137
commit
36d7231cad
@ -2,7 +2,6 @@
|
||||
<html lang="{{ .Lang }}">
|
||||
<head>
|
||||
{{ partial "head.html" . }}
|
||||
{{ partial "site-schema.html" . }}
|
||||
</head>
|
||||
<body>
|
||||
{{ partial "nav.html" . }}
|
||||
|
65
layouts/_default/section.html
Normal file
65
layouts/_default/section.html
Normal file
@ -0,0 +1,65 @@
|
||||
{{ define "header" }}
|
||||
<header class="header-section ">
|
||||
<div class="intro-header no-img">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
|
||||
<div class="page-heading">
|
||||
<h1>{{ if .Data.Singular }}#{{ end }}{{ .Title }}</h1>
|
||||
<hr class="small">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
{{ end }}
|
||||
{{ define "main" }}
|
||||
{{- $paginator := .Paginate (where .Data.Pages.ByDate.Reverse "Type" "post") }}
|
||||
<div class="container" role="main">
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
|
||||
{{ with .Content }}
|
||||
<div class="well">{{.}}</div>
|
||||
{{ end }}
|
||||
<div class="posts-list">
|
||||
<article class="post-preview">
|
||||
{{- range $index, $element := $paginator.Pages -}}
|
||||
{{- $thisYear := $element.Date.Format "2006" }}
|
||||
{{- $lastElement := $index | add -1 | index $paginator.Pages }}
|
||||
{{ if or (eq $index 0) ( ne ($lastElement.Date.Format "2006") $thisYear ) }}
|
||||
<div class="collection-title">
|
||||
<h2 class="archive-year">{{ $thisYear }}</h2>
|
||||
</div>
|
||||
{{- end }}
|
||||
<div class="archive-post">
|
||||
<span class="archive-post-time">
|
||||
{{ $element.Date.Format "01-02" }}
|
||||
</span>
|
||||
<span class="archive-post-title">
|
||||
<a href="{{ $element.URL }}" class="archive-post-link">
|
||||
{{ .Title }}
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
{{- end -}}
|
||||
</article>
|
||||
</div>
|
||||
{{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }}
|
||||
<ul class="pager main-pager">
|
||||
{{ if .Paginator.HasPrev }}
|
||||
<li class="previous">
|
||||
<a href="{{ .URL }}page/{{ .Paginator.Prev.PageNumber }}/">← {{ i18n "newerPosts" }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ if .Paginator.HasNext }}
|
||||
<li class="next">
|
||||
<a href="{{ .URL }}page/{{ .Paginator.Next.PageNumber }}/">{{ i18n "olderPosts" }} →</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
@ -37,7 +37,10 @@
|
||||
<meta property="og:description" content="{{ . }}">
|
||||
<meta name="twitter:description" content="{{ . | truncate 200 }}">
|
||||
{{- end }}
|
||||
<meta name="author" content="{{ .Site.Author.name }}"/>
|
||||
{{- with .Site.Author.name }}
|
||||
<meta name="author" content="{{ . }}"/>
|
||||
{{- end }}
|
||||
{{- partial "seo/main.html" . }}
|
||||
{{- with .Site.Params.favicon }}
|
||||
<link href='{{ . | absURL }}' rel='icon' type='image/x-icon'/>
|
||||
{{- end -}}
|
||||
|
3
layouts/partials/seo/main.html
Normal file
3
layouts/partials/seo/main.html
Normal file
@ -0,0 +1,3 @@
|
||||
{{- partial "seo/schema" . }}
|
||||
{{- partial "seo/opengraph" . }}
|
||||
{{- partial "seo/twitter" . }}
|
15
layouts/partials/seo/opengraph.html
Normal file
15
layouts/partials/seo/opengraph.html
Normal file
@ -0,0 +1,15 @@
|
||||
{{- with .Title | default .Site.Title }}
|
||||
<meta property="og:title" content="{{ . }}" />
|
||||
{{- end }}
|
||||
{{- with .Description | default .Params.subtitle | default .Summary }}
|
||||
<meta property="og:description" content="{{ . }}">
|
||||
{{- end }}
|
||||
{{- with .Params.share_img | default .Params.image | default .Site.Params.logo }}
|
||||
<meta property="og:image" content="{{ . | absURL }}" />
|
||||
{{- end }}
|
||||
{{- with .Site.Params.fb_app_id }}
|
||||
<meta property="fb:app_id" content="{{ . }}" />
|
||||
{{- end }}
|
||||
<meta property="og:url" content="{{ .URL | absLangURL }}" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:site_name" content="{{ .Site.Title }}" />
|
6
layouts/partials/seo/schema.html
Normal file
6
layouts/partials/seo/schema.html
Normal file
@ -0,0 +1,6 @@
|
||||
{{- partial "seo/structured/website" . }}
|
||||
{{- partial "seo/structured/organization" . }}
|
||||
{{ if .IsPage }}
|
||||
{{- partial "seo/structured/breadcrumb" . }}
|
||||
{{- partial "seo/structured/article" . }}
|
||||
{{ end }}
|
28
layouts/partials/seo/structured/article.html
Normal file
28
layouts/partials/seo/structured/article.html
Normal file
@ -0,0 +1,28 @@
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "http://schema.org",
|
||||
"@type": "Article",
|
||||
"author": {
|
||||
"name" : "{{ if .Params.author -}}{{ .Params.author }}{{- else if .Site.Author.name -}}{{ .Site.Author.name }}{{- end }}"
|
||||
},
|
||||
"headline": "{{ .Title }}",
|
||||
"description" : "{{ if .Description }}{{ .Description | plainify }}{{ else }}{{if .IsPage}}{{ .Summary | plainify }}{{ end }}{{ end }}",
|
||||
"inLanguage" : "{{ .Lang }}",
|
||||
"wordCount": {{ .WordCount }},
|
||||
"datePublished" : "{{ .PublishDate.Format "2006-01-02T15:04:05" }}",
|
||||
"dateModified" : "{{ .Date.Format "2006-01-02T15:04:05" }}",
|
||||
"image" : "{{ .Site.Params.logo | absURL }}",
|
||||
"keywords" : [ "{{ range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}{{ $e }}{{ end }}" ],
|
||||
"mainEntityOfPage" : "{{ .Permalink }}",
|
||||
"publisher" : {
|
||||
"@type": "Organization",
|
||||
"name" : "{{ .Site.BaseURL }}",
|
||||
"logo" : {
|
||||
"@type" : "ImageObject",
|
||||
"url" : "{{ .Site.Params.logo | absURL }}",
|
||||
"height" : 60 ,
|
||||
"width" : 60
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
21
layouts/partials/seo/structured/breadcrumb.html
Normal file
21
layouts/partials/seo/structured/breadcrumb.html
Normal file
@ -0,0 +1,21 @@
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "http://schema.org",
|
||||
"@type": "BreadcrumbList",
|
||||
"itemListElement": [{
|
||||
"@type": "ListItem",
|
||||
"position": 1,
|
||||
"item": {
|
||||
"@id": "{{ .Site.BaseURL }}",
|
||||
"name": "home"
|
||||
}
|
||||
},{
|
||||
"@type": "ListItem",
|
||||
"position": 3,
|
||||
"item": {
|
||||
"@id": "{{ .Permalink }}",
|
||||
"name": "{{ .Title | humanize }}"
|
||||
}
|
||||
}]
|
||||
}
|
||||
</script>
|
12
layouts/partials/seo/structured/organization.html
Normal file
12
layouts/partials/seo/structured/organization.html
Normal file
@ -0,0 +1,12 @@
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "http://schema.org",
|
||||
"@type": "Organization",
|
||||
"name": "{{ .Site.Params.organizationName }}",
|
||||
"url": "{{ .Site.BaseURL }}"
|
||||
{{ with .Site.Params.socialProfiles }}, "sameAs": {{ . }}{{ end }}
|
||||
{{ with .Site.Params.organizationLogo }}, "logo": "{{ . }}"{{ end }}
|
||||
{{ with .Site.Params.organizationAddress }}, "address": "{{ . }}"{{ end }}
|
||||
{{ with .Site.Data.organization.contacts.contactPoint }}, "contactPoint": {{ . }}{{ end }}
|
||||
}
|
||||
</script>
|
@ -1,28 +1,3 @@
|
||||
{{ if .IsHome -}}
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "http://schema.org",
|
||||
"@type": "WebSite",
|
||||
"url": "{{ .Site.BaseURL }}",
|
||||
{{ if .Site.Author.name -}}
|
||||
"author": {
|
||||
"@type": "Person",
|
||||
"name": "{{ .Site.Author.name }}"
|
||||
},
|
||||
{{- end }}
|
||||
{{ if .Site.Params.description -}}
|
||||
"description": "{{ .Site.Params.description }}",
|
||||
{{- end }}
|
||||
{{ if .Site.Params.logo -}}
|
||||
"image": "{{ .Site.Params.logo | absURL }}",
|
||||
{{- end }}
|
||||
{{ with .Site.Copyright -}}
|
||||
"license": "{{ . }}",
|
||||
{{- end }}
|
||||
"name": "{{ .Site.Title }}"
|
||||
}
|
||||
</script>
|
||||
{{- else if .IsPage -}}
|
||||
<script type="application/ld+json"> {
|
||||
"@context" : "http://schema.org",
|
||||
"@type" : "BlogPosting",
|
||||
@ -70,4 +45,3 @@
|
||||
}
|
||||
}
|
||||
} </script>
|
||||
{{ end }}
|
9
layouts/partials/seo/structured/website.html
Normal file
9
layouts/partials/seo/structured/website.html
Normal file
@ -0,0 +1,9 @@
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "http://schema.org",
|
||||
"@type": "WebSite",
|
||||
"name": "{{ .Site.Title }}",
|
||||
{{ with .Site.Params.alternatePageName }}"alternateName": "{{ . }}",{{ end }}
|
||||
"url": "{{ .Site.BaseURL }}"
|
||||
}
|
||||
</script>
|
14
layouts/partials/seo/twitter.html
Normal file
14
layouts/partials/seo/twitter.html
Normal file
@ -0,0 +1,14 @@
|
||||
{{- with .Title | default .Site.Title }}
|
||||
<meta name="twitter:title" content="{{ . | truncate 70 }}" />
|
||||
{{- end }}
|
||||
{{- with .Description | default .Params.subtitle | default .Summary }}
|
||||
<meta name="twitter:description" content="{{ . | truncate 200 }}">
|
||||
{{- end }}
|
||||
{{- with .Params.share_img | default .Params.image | default .Site.Params.logo }}
|
||||
<meta name="twitter:image" content="{{ . | absURL }}" />
|
||||
{{- end }}
|
||||
<meta name="twitter:card" content="summary" />
|
||||
{{- with .Site.Author.twitter }}
|
||||
<meta name="twitter:site" content="@{{ . }}" />
|
||||
<meta name="twitter:creator" content="@{{ . }}" />
|
||||
{{- end }}
|
@ -2,7 +2,7 @@ name = "Beautiful Hugo"
|
||||
license = "MIT"
|
||||
licenselink = "https://github.com/halogenica/Hugo-BeautifulHugo/blob/master/LICENSE"
|
||||
description = "A port of Beautiful Jekyll theme"
|
||||
tags = ["blog", "company", "portfolio", "projects", "minimal", "responsive"]
|
||||
tags = ["blog", "company", "portfolio", "projects", "minimal", "responsive", "seo"]
|
||||
features = ["blog", "themes", "disqus", "minimal", "responsive", "staticman"]
|
||||
min_version = 0.28
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user