From e7dd2d158b5c9a5ec14824f293d317071d8103fc Mon Sep 17 00:00:00 2001 From: Alessandro Manno Date: Thu, 2 Apr 2020 12:35:07 +0200 Subject: [PATCH] Updated theme --- README.md | 32 ++++++++++++++++++++++++++++ exampleSite/config.toml | 19 +++++++++++++++-- layouts/partials/footer.html | 1 + layouts/partials/footer_mathjax.html | 5 +++++ layouts/partials/header.html | 1 + layouts/partials/navbar.html | 2 +- layouts/partials/rss-icon.html | 5 +++++ layouts/partials/seo_schema.html | 26 ++++++++++++++++++++++ layouts/partials/share-links.html | 17 +++++++++++++++ layouts/partials/sidebar.html | 12 ++++------- static/css/main.css | 8 ++++--- 11 files changed, 114 insertions(+), 14 deletions(-) create mode 100644 layouts/partials/footer_mathjax.html create mode 100644 layouts/partials/rss-icon.html create mode 100644 layouts/partials/seo_schema.html diff --git a/README.md b/README.md index 68ad0168..6aabc9ca 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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: diff --git a/exampleSite/config.toml b/exampleSite/config.toml index faee664b..3ff41842 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -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 @@ -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". @@ -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. @@ -177,6 +192,6 @@ pluralizeListTitles = false vine = "" googlescholar = "" orcid = "" - researchgate = "example" + researchgate = "example" # Email email = "example" diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 075b75c6..d5d3f5de 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -47,5 +47,6 @@ $('.lazy').Lazy(); }); + {{ partial "footer_mathjax" . }} diff --git a/layouts/partials/footer_mathjax.html b/layouts/partials/footer_mathjax.html new file mode 100644 index 00000000..bd331bcb --- /dev/null +++ b/layouts/partials/footer_mathjax.html @@ -0,0 +1,5 @@ + + + diff --git a/layouts/partials/header.html b/layouts/partials/header.html index a121dd67..74edb706 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -6,6 +6,7 @@ --> + {{ partial "seo_schema" . }} {{ with $.Scratch.Get "generalTitle" }} {{ . }} {{ else }} diff --git a/layouts/partials/navbar.html b/layouts/partials/navbar.html index 1f1812cb..0dca6f17 100644 --- a/layouts/partials/navbar.html +++ b/layouts/partials/navbar.html @@ -67,7 +67,7 @@

-
+

Recent Posts

diff --git a/layouts/partials/rss-icon.html b/layouts/partials/rss-icon.html new file mode 100644 index 00000000..a48d5fdc --- /dev/null +++ b/layouts/partials/rss-icon.html @@ -0,0 +1,5 @@ +{{ if .RSSLink }} +
  • +{{ else }} +
  • +{{ end }} diff --git a/layouts/partials/seo_schema.html b/layouts/partials/seo_schema.html new file mode 100644 index 00000000..a30598d6 --- /dev/null +++ b/layouts/partials/seo_schema.html @@ -0,0 +1,26 @@ + \ No newline at end of file diff --git a/layouts/partials/share-links.html b/layouts/partials/share-links.html index 236dc380..ef1d96c2 100644 --- a/layouts/partials/share-links.html +++ b/layouts/partials/share-links.html @@ -1,65 +1,82 @@ +{{ if .Site.Params.socialShareTwitter | default true}}
  • +{{ end }} +{{ if .Site.Params.socialShareGoogleplus | default true}}
  • +{{ end }} +{{ if .Site.Params.socialShareFacebook | default true}} +
  • +{{ end }} +{{ if .Site.Params.socialShareReddit | default true}}
  • +{{ end }} +{{ if .Site.Params.socialShareLinkedin | default true}}
  • +{{ end }} +{{ if .Site.Params.socialShareStumbleupon | default true}}
  • +{{ end }} +{{ if .Site.Params.socialSharePinterest | default true}}
  • +{{ end }} +{{ if .Site.Params.socialShareEmail | default true}}
  • +{{ end }} diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 01c6eab2..013b9f67 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -22,9 +22,7 @@

    {{ .header }}

    {{ if .Site.Params.socialAppearAtTop }}
      {{ if .Site.Params.rssAppearAtTop }} -
    • - -
    • + {{ partial "rss-icon" . }} {{ end }} {{ partial "social" . }}
    @@ -32,7 +30,7 @@

    {{ .header }}

    -
    +

    Recent Posts

    @@ -127,7 +125,7 @@

    {{ with .Site.Params.intro.about }}
    -

    About

    +

    About

    {{ . | safeHTML }}

    Learn More
    @@ -138,9 +136,7 @@

    About

    {{ if .Site.Params.socialAppearAtBottom }}
      {{ if .Site.Params.rssAppearAtBottom }} -
    • - -
    • + {{ partial "rss-icon" . }} {{ end }} {{ partial "social" . }}
    diff --git a/static/css/main.css b/static/css/main.css index ba32a84c..dbd8f8c4 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -130,8 +130,6 @@ } - } - @media screen and (max-width: 980px) { body, input, select, textarea { @@ -210,6 +208,10 @@ border-bottom: 0; } + h1 { + font-size: 1.3em; + } + h2 { font-size: 1.1em; } @@ -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; }