Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Updated theme #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ interested in seeing a live example.
- [exampleSite](#examplesite)
- [config.toml](#configtoml)
- [Hugo's Built-In Server](#hugos-built-in-server)
- [Hugo's website SEO](#hugos-website-seo)
- [Shortcodes](#shortcodes)
- [fancybox](#fancybox)
- [img-post](#img-post)
Expand Down Expand Up @@ -115,6 +116,37 @@ hugo server

You will then be able to view your live website at [localhost:1313](http://localhost:1313).

### Hugo's website SEO

This theme support SEO elements for your website.
It was adapted and integrated thanks to the following guide:
[https://keithpblog.org/post/hugo-website-seo/](https://keithpblog.org/post/hugo-website-seo/)

If you wish to enable SEO on this theme, follow these instructions:
1. To include the following parameters in your _config.toml_
```
# .config.toml
...
enableRobotsTXT = true
canonifyURLs = true
# and if you think your md file names or locations might change:
[permalinks]
post = "/blog/:title/"
...
```

2. Add your website to Google Search Console:
- Login to the [Google Search Console](https://www.google.com/webmasters/tools/home)
- Add your website as property
- Add the html page as required by google to verify ownership
- Submit the sitemap (/sitemap.xml) for indexing
- Wait

3. Add your website to Bing
- Login to the [Bing Webmaster Console](https://www.bing.com/toolbox/webmaster/)
- Add your site, details and verify
- From the 3 option, we recommend adding the xml file to you website

## Shortcodes
In addition to the native [Hugo shortcodes](https://gohugo.io/extras/shortcodes/),
the theme also includes the following codes that I hope you find useful:
Expand Down
19 changes: 17 additions & 2 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ paginate = 3
disqusShortname = "shortname"
googleAnalytics = ""
pluralizeListTitles = false
# Set the followings to true as part of your site SEO
enableRobotsTXT = true
canonifyURLs = true

[params]
# Sets the meta tag description
Expand Down Expand Up @@ -39,6 +42,16 @@ pluralizeListTitles = false
faviconVersion = ""
# Sets Social Share links to appear on posts
socialShare = true
# Sets specific share to appear on posts (default behavior is to appear)
socialShareTwitter = true
socialShareGoogleplus = true
socialShareFacebook = true
socialShareReddit = true
socialShareLinkedin = true
socialShareStumbleupon = true
socialSharePinterest = true
socialShareEmail = true

# Load custom CSS or JavaScript files. The variable is an array so that you
# can load multiple files if necessary. You can also load the standard theme
# files by adding the value, "default".
Expand All @@ -53,7 +66,9 @@ pluralizeListTitles = false
highlightjsCDN = "//cdn.bootcss.com"
highlightjsLang = ["r", "yaml", "css"]
highlightjsTheme = "github"

MathJaxCDN = "//cdn.bootcss.com"
MathJaxVersion = "2.7.1"

# Disqus will take priority over Staticman (github.com/eduardoboucas/staticman)
# due to its ease of use. Feel free to check out both and decide what you would
# prefer to use. See Staticman.yml for additional settings.
Expand Down Expand Up @@ -177,6 +192,6 @@ pluralizeListTitles = false
vine = ""
googlescholar = ""
orcid = ""
researchgate = "example"
researchgate = "example"
# Email
email = "example"
1 change: 1 addition & 0 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@
$('.lazy').Lazy();
});
</script>
{{ partial "footer_mathjax" . }}
</body>
</html>
5 changes: 5 additions & 0 deletions layouts/partials/footer_mathjax.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script src="//yihui.name/js/math-code.js"></script>
<script async
src="{{ .Site.Params.MathJaxCDN | default "//cdn.bootcss.com"}}/mathjax/{{ .Site.Params.MathJaxVersion | default "2.7.1" }}/MathJax.js?config=TeX-MML-AM_CHTML">
</script>

1 change: 1 addition & 0 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
-->
<html>
<head>
{{ partial "seo_schema" . }}
{{ with $.Scratch.Get "generalTitle" }}
<title>{{ . }}</title>
{{ else }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ <h3>
</section>

<!-- Posts List -->
<section id="recent-posts">
<section class="recent-posts">
<div class="mini-posts">
<header>
<h3>Recent Posts</h3>
Expand Down
5 changes: 5 additions & 0 deletions layouts/partials/rss-icon.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{ if .RSSLink }}
<li><a href="{{ .RSSLink }}" type="application/rss+xml" target="_blank" title="RSS" class="fa fa-rss"></a></li>
{{ else }}
<li><a href="{{ .Site.RSSLink }}" type="application/rss+xml" target="_blank" title="RSS" class="fa fa-rss"></a></li>
{{ end }}
26 changes: 26 additions & 0 deletions layouts/partials/seo_schema.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "BlogPosting",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "{{ .Site.BaseURL }}"
},
"articleSection" : "{{ .Section }}",
"name" : "{{ .Title }}",
"headline" : "{{ .Title }}",
"description" : "{{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}",
"inLanguage" : "{{ .Lang }}",
"author" : "{{ range .Site.Author }}{{ . }}{{ end }}",
"creator" : "{{ range .Site.Author }}{{ . }}{{ end }}",
"publisher": "{{ range .Site.Author }}{{ . }}{{ end }}",
"accountablePerson" : "{{ range .Site.Author }}{{ . }}{{ end }}",
"copyrightHolder" : "{{ range .Site.Author }}{{ . }}{{ end }}",
"copyrightYear" : "{{ .Date.Format "2006" }}",
"datePublished": "{{ .Date }}",
"dateModified" : "{{ .Date }}",
"url" : "{{ .Permalink }}",
"wordCount" : "{{ .WordCount }}",
"keywords" : [ {{ if isset .Params "tags" }}{{ range .Params.tags }}"{{ . }}",{{ end }}{{ end }}"Blog" ]
}
</script>
17 changes: 17 additions & 0 deletions layouts/partials/share-links.html
Original file line number Diff line number Diff line change
@@ -1,65 +1,82 @@
<!-- Social Share Button HTML -->

<!-- Twitter -->
{{ if .Site.Params.socialShareTwitter | default true}}
<li>
<a href="//twitter.com/share?url={{ .Permalink }}&amp;text={{ .Title }}&amp;via={{ .Site.Social.twitter }}" target="_blank" class="share-btn twitter">
<i class="fa fa-twitter"></i>
<p>Twitter</p>
</a>
</li>
{{ end }}

<!-- Google Plus -->
{{ if .Site.Params.socialShareGoogleplus | default true}}
<li>
<a href="//plus.google.com/share?url={{ .Permalink }}" target="_blank" class="share-btn google-plus">
<i class="fa fa-google-plus"></i>
<p>Google+</p>
</a>
</li>
{{ end }}

<!-- Facebook -->
{{ if .Site.Params.socialShareFacebook | default true}}

<li>
<a href="//www.facebook.com/sharer/sharer.php?u={{ .Permalink }}" target="_blank" class="share-btn facebook">
<i class="fa fa-facebook"></i>
<p>Facebook</p>
</a>
</li>
{{ end }}

<!-- Reddit -->
{{ if .Site.Params.socialShareReddit | default true}}
<li>
<a href="//reddit.com/submit?url={{ .Permalink }}&amp;title={{ .Title }}" target="_blank" class="share-btn reddit">
<i class="fa fa-reddit-alien"></i>
<p>Reddit</p>
</a>
</li>
{{ end }}

<!-- LinkedIn -->
{{ if .Site.Params.socialShareLinkedin | default true}}
<li>
<a href="//www.linkedin.com/shareArticle?url={{ .Permalink }}&amp;title={{ .Title }}" target="_blank" class="share-btn linkedin">
<i class="fa fa-linkedin"></i>
<p>LinkedIn</p>
</a>
</li>
{{ end }}

<!-- StumbleUpon -->
{{ if .Site.Params.socialShareStumbleupon | default true}}
<li>
<a href="//www.stumbleupon.com/submit?url={{ .Permalink }}&amp;title={{ .Title }}" target="_blank" class="share-btn stumbleupon">
<i class="fa fa-stumbleupon"></i>
<p>StumbleUpon</p>
</a>
</li>
{{ end }}

<!-- Pintrest -->
{{ if .Site.Params.socialSharePinterest | default true}}
<li>
<a href="//www.pinterest.com/pin/create/button/?url={{ .Permalink }}&amp;description={{ .Title }}" target="_blank" class="share-btn pinterest">
<i class="fa fa-pinterest-p"></i>
<p>Pinterest</p>
</a>
</li>
{{ end }}

<!-- Email -->
{{ if .Site.Params.socialShareEmail | default true}}
<li>
<a href="mailto:?subject=Check out this post by {{ .Params.author }}&amp;body={{ .Permalink }}" target="_blank" class="share-btn email">
<i class="fa fa-envelope"></i>
<p>Email</p>
</a>
</li>
{{ end }}
12 changes: 4 additions & 8 deletions layouts/partials/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,15 @@ <h2>{{ .header }}</h2>
{{ if .Site.Params.socialAppearAtTop }}
<ul class="icons">
{{ if .Site.Params.rssAppearAtTop }}
<li>
<a href="{{ .RSSLink }}" type="application/rss+xml" target="_blank" title="RSS" class="fa fa-rss"></a>
</li>
{{ partial "rss-icon" . }}
{{ end }}
{{ partial "social" . }}
</ul>
{{ end }}
</section>

<!-- Posts List -->
<section id="recent-posts">
<section class="recent-posts">
<div class="mini-posts">
<header>
<h3>Recent Posts</h3>
Expand Down Expand Up @@ -127,7 +125,7 @@ <h3>
<!-- About -->
{{ with .Site.Params.intro.about }}
<section id="mini-bio">
<h3>About</h1>
<h3>About</h3>
<p>{{ . | safeHTML }}</p>
<a href="/ita/chi-siamo/" class="button">Learn More</a>
</section>
Expand All @@ -138,9 +136,7 @@ <h3>About</h1>
{{ if .Site.Params.socialAppearAtBottom }}
<ul class="icons">
{{ if .Site.Params.rssAppearAtBottom }}
<li>
<a href="{{ .RSSLink }}" type="application/rss+xml" target="_blank" title="RSS" class="fa fa-rss"></a>
</li>
{{ partial "rss-icon" . }}
{{ end }}
{{ partial "social" . }}
</ul>
Expand Down
8 changes: 5 additions & 3 deletions static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@

}

}

@media screen and (max-width: 980px) {

body, input, select, textarea {
Expand Down Expand Up @@ -210,6 +208,10 @@
border-bottom: 0;
}

h1 {
font-size: 1.3em;
}

h2 {
font-size: 1.1em;
}
Expand Down Expand Up @@ -569,7 +571,7 @@
select:hover,
textarea:hover {
-webkit-transition:border-color 0.3s ease-in-out;
moz-transition:border-color 0.3s ease-in-out;
-moz-transition:border-color 0.3s ease-in-out;
transition:border-color 0.3s ease-in-out;
border-color: #2ebaae;
}
Expand Down