Updates to SEO

This commit is contained in:
Michael Romero 2018-11-01 01:38:13 -07:00
parent 5bbbd39137
commit 36d7231cad
13 changed files with 179 additions and 30 deletions

View File

@ -2,7 +2,6 @@
<html lang="{{ .Lang }}"> <html lang="{{ .Lang }}">
<head> <head>
{{ partial "head.html" . }} {{ partial "head.html" . }}
{{ partial "site-schema.html" . }}
</head> </head>
<body> <body>
{{ partial "nav.html" . }} {{ partial "nav.html" . }}

View 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 }}/">&larr; {{ i18n "newerPosts" }}</a>
</li>
{{ end }}
{{ if .Paginator.HasNext }}
<li class="next">
<a href="{{ .URL }}page/{{ .Paginator.Next.PageNumber }}/">{{ i18n "olderPosts" }} &rarr;</a>
</li>
{{ end }}
</ul>
{{ end }}
</div>
</div>
</div>
{{ end }}

View File

@ -37,7 +37,10 @@
<meta property="og:description" content="{{ . }}"> <meta property="og:description" content="{{ . }}">
<meta name="twitter:description" content="{{ . | truncate 200 }}"> <meta name="twitter:description" content="{{ . | truncate 200 }}">
{{- end }} {{- 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 }} {{- with .Site.Params.favicon }}
<link href='{{ . | absURL }}' rel='icon' type='image/x-icon'/> <link href='{{ . | absURL }}' rel='icon' type='image/x-icon'/>
{{- end -}} {{- end -}}

View File

@ -0,0 +1,3 @@
{{- partial "seo/schema" . }}
{{- partial "seo/opengraph" . }}
{{- partial "seo/twitter" . }}

View 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 }}" />

View File

@ -0,0 +1,6 @@
{{- partial "seo/structured/website" . }}
{{- partial "seo/structured/organization" . }}
{{ if .IsPage }}
{{- partial "seo/structured/breadcrumb" . }}
{{- partial "seo/structured/article" . }}
{{ end }}

View 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>

View 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>

View 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>

View File

@ -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"> { <script type="application/ld+json"> {
"@context" : "http://schema.org", "@context" : "http://schema.org",
"@type" : "BlogPosting", "@type" : "BlogPosting",
@ -69,5 +44,4 @@
"width" : 60 "width" : 60
} }
} }
} </script> } </script>
{{ end }}

View 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>

View 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 }}

View File

@ -2,7 +2,7 @@ name = "Beautiful Hugo"
license = "MIT" license = "MIT"
licenselink = "https://github.com/halogenica/Hugo-BeautifulHugo/blob/master/LICENSE" licenselink = "https://github.com/halogenica/Hugo-BeautifulHugo/blob/master/LICENSE"
description = "A port of Beautiful Jekyll theme" 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"] features = ["blog", "themes", "disqus", "minimal", "responsive", "staticman"]
min_version = 0.28 min_version = 0.28