diff options
-rw-r--r-- | CHANGELOG.md | 7 | ||||
-rw-r--r-- | README.md | 28 | ||||
-rw-r--r-- | layouts/404.html | 16 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 10 | ||||
-rw-r--r-- | layouts/_default/list.html | 27 | ||||
-rw-r--r-- | layouts/_default/single.html | 72 | ||||
-rw-r--r-- | layouts/index.html | 36 | ||||
-rw-r--r-- | layouts/partials/disqus.html | 14 | ||||
-rw-r--r-- | layouts/partials/head.html | 9 | ||||
-rw-r--r-- | layouts/partials/head_fonts.html | 1 | ||||
-rw-r--r-- | layouts/partials/hook_head_end.html | 0 | ||||
-rw-r--r-- | layouts/partials/sidebar.html | 13 | ||||
-rw-r--r-- | static/css/print.css | 19 | ||||
-rw-r--r-- | theme.toml | 2 |
14 files changed, 141 insertions, 113 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..891329a --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog + +## Version 1.0 + +- Due to the switch to the base template feature the minimum required version of Hugo changed to v0.21 +- Support for Google Analytics have been added +- Hugo's internal Disqus template replaced the custom one of this theme. The Disqus shortname now has to be defined outsite the `[params]` blog diff --git a/README.md b/README.md index 45ee21f..d8cb82c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Hyde -Hyde is a brazen two-column [hugo](http://hugo.spf13.com) theme based on the [Jekyll](http://jekyllrb.com) theme of the same name. +Hyde is a brazen two-column [hugo](https://gohugo.io) theme based on the [Jekyll](http://jekyllrb.com) theme of the same name. It pairs a prominent sidebar with uncomplicated content. ![Hyde screenshot](https://f.cloud.github.com/assets/98681/1831228/42af6c6a-7384-11e3-98fb-e0b923ee0468.png) @@ -15,6 +15,7 @@ It pairs a prominent sidebar with uncomplicated content. - [Themes](#themes) - [Reverse layout](#reverse-layout) - [Disqus](#disqus) + - [Google Analytics](#google-analytics) - [Author](#author) - [Ported by](#ported-by) - [License](#license) @@ -119,18 +120,33 @@ params: ### Disqus -You can optionally enable a comment system powered by Disqus for the posts. Simply add the variable `disqusShortname` to the `params` in your config file. +You can optionally enable a comment system powered by Disqus for the posts. Simply add the variable `disqusShortname` to your config file. **TOML** ```toml -[params] - disqusShortname = "spf13" +disqusShortname = "spf13" ``` **YAML** ```yaml -params: - disqusShortname: "spf13" +disqusShortname : spf13 +``` + +> **Note:** Previous version 1.0 the Disqus shortname had to be defined inside the `[params]` block. + + +## Google Analytics + +Google Analytics can be enabled by assigning your tracking code to the `googleAnalytics` variable in the config file: + +**TOML** +```toml +googleAnalytics = "Your tracking code" +``` + +**YAML** +```yaml +googleAnalytics: Your tracking code ``` ## Author diff --git a/layouts/404.html b/layouts/404.html index 8fa1a59..a919514 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,12 +1,4 @@ -{{ partial "head.html" . }} -<body class="{{ .Site.Params.themeColor }}"> - -{{ partial "sidebar.html" . }} - - <div class="content container"> - <h1>404: Page not found</h1> - <p class="lead">Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. <a href="{{ .Site.BaseURL }}">Head back home</a> to try finding it again.</p> - </div> - - </body> -</html> +{{ define "main" -}} +<h1>404: Page not found</h1> +<p class="lead">Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. <a href="{{ .Site.BaseURL }}">Head back home</a> to try finding it again.</p> +{{- end }} \ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..0c87c3f --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,10 @@ +{{ partial "head.html" . }} + <body class="{{ .Site.Params.themeColor }} {{if .Site.Params.layoutReverse}}layout-reverse{{end}}"> + {{ partial "sidebar.html" . }} + <div class="content container"> + {{ block "main" . -}}{{- end }} + </div> + + {{ template "_internal/google_analytics_async.html" . }} + </body> +</html> \ No newline at end of file diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 6aa2a7d..cae4c08 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,16 +1,11 @@ -{{ partial "head.html" . }} - <body class="{{ .Site.Params.themeColor }} {{if .Site.Params.layoutReverse}}layout-reverse{{end}}"> - <main class="content container" role="main"> - <h1 class="page-title">{{ .Title }}</h1> - <ul class="posts"> - {{ range .Data.Pages }} - <li> - <a class="post-title u-url" href="{{ .RelPermalink | replaceRE "/$" "" }}">{{ .Title }}</a> - <time class="post-date" datetime="{{ .Date.Format "2006-01-02T15:04:05Z" }}">{{ .Date.Format "Monday, 2 January 2006" }}</time> - </li> - {{ end }} - </ul> - </main> -{{ partial "sidebar.html" . }} - </body> -</html> +{{ define "main" -}} +<h1 class="page-title">{{ .Title }}</h1> +<ul class="posts"> +{{ range .Data.Pages -}} + <li> + <a class="post-title u-url" href="{{ .RelPermalink }}">{{ .Title }}</a> + <time class="post-date" datetime="{{ .Date.Format "2006-01-02T15:04:05Z" }}">{{ .Date.Format "Monday, 2 January 2006" }}</time> + </li> +{{- end }} +</ul> +{{- end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 1f48df8..fb048a2 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,37 +1,37 @@ -{{ partial "head.html" . }} - <body class="{{ .Site.Params.themeColor }} {{if .Site.Params.layoutReverse}}layout-reverse{{end}} h-entry"> - <main class="content container" role="main"> - <article class="post"> - <header> - <a class="u-url" href="{{ .Permalink | replaceRE "/$" "" }}"> - <h1 class="post-title p-name">{{ .Title }}</h1> - </a> - <time class="post-date dt-published" datetime="{{ .Date.Format "2006-01-02T15:04:05Z" }}">{{ .Date.Format "Monday, 2 January 2006" }}</time> - </header> - <main class="post-content e-content"> - {{ .Content }} - </main> - <footer class="footer"> - {{ if .Params.categories }} - <span> - Category: - {{ range .Params.categories }} - <a class="p-category" href="/categories/{{ . | lower | urlize }}/">{{ . }}</a> - {{ end }} - </span> - {{ end }} - {{ if .Params.tags }} - <p> - Tags: - {{ range .Params.tags }} - <a class="p-category" href="/tags/{{ . | urlize }}/">{{ . }}</a> - {{ end }} +{{ define "main" -}} +<article class="post h-entry"> + <header> + <a class="u-url" href="{{ .Permalink | replaceRE "/$" "" }}"> + <h1 class="post-title p-name">{{ .Title }}</h1> + </a> + <time class="post-date dt-published" datetime="{{ .Date.Format "2006-01-02T15:04:05Z" }}">{{ .Date.Format "Monday, 2 January 2006" }}</time> + </header> + <main class="post-content e-content"> + {{ .Content }} + </main> + <footer class="footer"> + {{ if .Params.categories }} + <span> + Category: + {{ range .Params.categories }} + <a class="p-category" href="/categories/{{ . | lower | urlize }}/">{{ . }}</a> + {{ end }} + </span> + {{ end }} + {{ if .Params.tags }} + <p> + Tags: + {{ range .Params.tags }} + <a class="p-category" href="/tags/{{ . | urlize }}/">{{ . }}</a> + {{ end }} - </p> - {{ end }} - </footer> - </article> - </main> -{{ partial "sidebar.html" . }} - </body> -</html> + </p> + {{ end }} + </footer> +</article> + +{{ if .Site.DisqusShortname -}} +<h2>Comments</h2> +{{ template "_internal/disqus.html" . }} +{{- end }} +{{- end }} diff --git a/layouts/index.html b/layouts/index.html index 9d181dc..04d3175 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,18 +1,18 @@ -{{ partial "head.html" . }} - <body class="{{ .Site.Params.themeColor }} {{if .Site.Params.layoutReverse}}layout-reverse{{end}}"> - <main class="content container" role="main"> - <section class="recent"> - <h2>Recent Posts</h2> - <ul class="posts"> - {{ range first 10 .Data.Pages }} - <li> - <a class="post-title" href="{{ .RelPermalink | replaceRE "/$" "" }}">{{ .Title }}</a> - <time class="post-date" datetime="{{ .Date.Format "2006-01-02T15:04:05Z" }}">{{ .Date.Format "Monday, 2 January 2006" }}</time> - </li> - {{ end }} - </ul> - </section> - </main> -{{ partial "sidebar.html" . }} - </body> -</html> +{{ define "main" -}} +<div class="posts"> +{{ range .Data.Pages -}} +<div class="post"> + <h1 class="post-title"> + <a href="{{ .Permalink }}">{{ .Title }}</a> + </h1> + <time class="post-date" datetime="{{ .Date.Format "2006-01-02T15:04:05Z" }}">{{ .Date.Format "Monday, 2 January 2006" }}</time> + {{ .Summary }} + {{ if .Truncated }} + <div class="read-more-link"> + <a href="{{ .RelPermalink }}">Read Moreā¦</a> + </div> + {{ end }} +</div> +{{- end }} +</div> +{{- end }} diff --git a/layouts/partials/disqus.html b/layouts/partials/disqus.html deleted file mode 100644 index 323ae04..0000000 --- a/layouts/partials/disqus.html +++ /dev/null @@ -1,14 +0,0 @@ -<div id="disqus_thread"></div> -<script type="text/javascript"> - /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ - var disqus_shortname = '{{ .Site.Params.disqusShortname }}'; // Required - Replace '<example>' with your forum shortname - - /* * * DON'T EDIT BELOW THIS LINE * * */ - (function() { - var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; - dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; - (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); - })(); -</script> -<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> -</div> \ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 59304c2..c92ea95 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -4,15 +4,16 @@ <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> - {{ if .IsHome }} + {{ if .IsHome -}} <title>{{ .Site.Title }}</title> - {{ else }} + {{- else -}} <title>{{ .Title }} · {{ .Site.Title }}</title> - {{ end }} + {{- end }} + <link type="text/css" rel="stylesheet" href="{{ .Site.BaseURL }}css/print.css" media="print"> <link rel="stylesheet" href="/css/poole.css"> <link rel="stylesheet" href="/css/syntax.css"> <link rel="stylesheet" href="/css/hyde.css"> <link href="{{ .RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}"> - <link href="{{ if .IsPage }}{{ .Permalink | replaceRE "/$" "" }}{{ else }}{{ .Permalink }}{{ end }}" rel="canonical"> + {{ partial "hook_head_end.html" . }} </head> diff --git a/layouts/partials/head_fonts.html b/layouts/partials/head_fonts.html new file mode 100644 index 0000000..4729eb2 --- /dev/null +++ b/layouts/partials/head_fonts.html @@ -0,0 +1 @@ + <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Abril+Fatface|PT+Sans:400,400i,700"> diff --git a/layouts/partials/hook_head_end.html b/layouts/partials/hook_head_end.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/layouts/partials/hook_head_end.html diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index a076070..e6aadac 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -1,29 +1,30 @@ <aside class="sidebar container"> <header class="sidebar-about h-card vcard p-author"> - {{ if (isset .Site.Author "image") }} + {{ if (isset .Site.Author "image") -}} <a class="u-url u-uid" rel="me" href="{{ .Site.BaseURL }}"> <img class="u-photo" src="{{ .Site.Author.image }}" width=128 height=128 /> </a> - {{ end }} + {{ end -}} - {{ if eq .Title .Site.Title }} + {{ if eq .Title .Site.Title -}} <h1 class="site-title u-name fn">{{ .Site.Title }}</h1> - {{ else }} + {{ else -}} <span class="site-title u-name fn">{{ .Site.Title }}</span> - {{ end }} + {{ end -}} <p class="lead p-note"> {{ with .Site.Params.Description }} {{.}} {{ else }}An elegant open source and mobile first theme for <a href="http://hugo.spf13.com">hugo</a> made by <a href="http://twitter.com/mdo">@mdo</a>. Originally made for Jekyll.{{end}} </p> + </header> <nav> <ul class="sidebar-nav"> + <li><a href="{{ .Site.BaseURL }}">Home</a></li> {{ range .Site.Menus.main }} <li><a href="{{.URL}}"> {{ .Name }} </a></li> {{end}} </ul> </nav> - </header> <footer> Licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>. diff --git a/static/css/print.css b/static/css/print.css new file mode 100644 index 0000000..da8f1df --- /dev/null +++ b/static/css/print.css @@ -0,0 +1,19 @@ +.sidebar { + display: none !important; +} + +.content { + margin: 0 auto; + width: 100%; + float: none; + display: initial; +} + +.container { + width: 100%; + float: none; + display: initial; + padding-left: 1rem; + padding-right: 1rem; + margin: 0 auto; +} diff --git a/theme.toml b/theme.toml index 66ca805..4703ca5 100644 --- a/theme.toml +++ b/theme.toml @@ -4,7 +4,7 @@ licenselink = "https://github.com/spf13/hyde/blob/master/LICENSE.md" description = "An elegant open source and mobile first theme" tags = ["blog", "company"] features = ["blog", "themes", "disqus"] -min_version = 0.20 +min_version = 0.21 [author] name = "spf13" |