From f4aa888a5cdae4eb6109ef198e8e442320a761d1 Mon Sep 17 00:00:00 2001 From: Huy Tran Date: Tue, 10 Jul 2018 11:41:30 +1000 Subject: [PATCH] Restructures the templates --- README.md | 8 +- layouts/_default/baseof.html | 14 +-- layouts/_default/single.html | 6 +- layouts/index.html | 14 +-- layouts/partials/commenting.html | 17 ++- .../disqus.html} | 0 .../graphcomment.html} | 0 layouts/partials/content_list.html | 4 +- layouts/partials/highlight.html | 4 +- layouts/partials/sidebar.html | 7 +- .../{sidebar_menu.html => sidebar/menu.html} | 7 +- .../social.html} | 46 ++++---- static/css/syntax.css | 108 ++++++++---------- static/css/syntax.min.css | 1 + 14 files changed, 108 insertions(+), 128 deletions(-) rename layouts/partials/{commenting_disqus.html => commenting/disqus.html} (100%) rename layouts/partials/{commenting_graph.html => commenting/graphcomment.html} (100%) rename layouts/partials/{sidebar_menu.html => sidebar/menu.html} (82%) rename layouts/partials/{sidebar_social.html => sidebar/social.html} (68%) create mode 100644 static/css/syntax.min.css diff --git a/README.md b/README.md index 46400f2..7b712f3 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,14 @@ __`hyde-hyde`__ is a [Hugo](https://gohugo.io)'s theme derived from @spf13's [Hyde](https://github.com/spf13/hyde.git) which is in turn ported from @mdo Jekyll's [Hyde](https://github.com/poole/hyde). ## Notable Changes +* Color tones and layouts are inspired by [Nate Finch's blog](https://npf.io) * Restructuring/modularising the layouts (see [`layouts/_default/baseof.html`](https://github.com/htr3n/hyde-hyde/blob/master/layouts/_default/baseof.html), [`layouts/_default/single.html`](https://github.com/htr3n/hyde-hyde/blob/master/layouts/_default/single.html), [`layouts/_default/list.html`](https://github.com/htr3n/hyde-hyde/blob/master/layouts/_default/list.html) and [`layouts/partials`](https://github.com/htr3n/hyde-hyde/blob/master/layouts/partials/)) -* Using [highlight.js](https://highlightjs.org) for highlighting code -* Using [Font-Awesome 5](https://fontawesome.com) for icons -* Using color tones inspired by [Nate Finch's blog](https://npf.io) +* Using [highlight.js](https://highlightjs.org) for code highlighting +* Using [Font-Awesome 5](https://fontawesome.com)'s icons * Using main font [Fira-Sans](https://fonts.google.com/specimen/Fira+Sans) + fixed width font [Roboto Mono](https://fonts.google.com/specimen/Roboto+Mono) * Adding [GraphComment](https://graphcomment.com) for replacing the built-in [Disqus](https://disqus.com) -A real site in action can be found [here](https://htr3n.github.io). +A real site in action can be found [here](https://htr3n.github.io) with its [WIP source](https://github.com/htr3n/htr3n-blog) for reference. Some screenshots: diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index ab62a7c..97b1f76 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,16 +1,14 @@ {{ block "header" . -}}{{- end }} - - {{ partial "sidebar.html" . }} + + {{ partial "sidebar.html" . -}}
- {{ block "content" . }}{{ end }} - + {{ block "content" . -}}{{- end }}
- - {{ if .Site.GoogleAnalytics -}} + {{ block "footer" . -}}{{- end }} + {{ if and (not .Site.BuildDrafts) (.Site.GoogleAnalytics) -}} + {{ "" | safeHTML }} {{ template "_internal/google_analytics_async.html" . }} {{- end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 20d9f56..2879afb 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -7,6 +7,8 @@ {{- end -}} {{ define "footer" -}} - {{ partial "highlight.html" . }} - {{ partial "commenting.html" . }} + {{- end -}} diff --git a/layouts/index.html b/layouts/index.html index d1fa9e8..ec8f7fb 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -4,22 +4,22 @@ {{ define "content" -}}
- {{ range (where .Data.Pages "Type" "!=" "about").GroupBy "Section" }} + {{ range (where .Data.Pages "Type" "not in" (slice "about" "portfolio")).GroupBy "Section" -}} {{ range .Pages }}
-

{{ .Title }}{{ if .Draft }}{{ end }}

+

{{ .Title }}{{ if .Draft }} {{ end }}

- {{ .Summary }} - {{ if .Truncated }} + {{ .Summary }} + {{- if .Truncated }} - {{ end }} + {{- end }}
- {{- end -}} - {{- end }} + {{- end -}} + {{- end }}
{{- end }} diff --git a/layouts/partials/commenting.html b/layouts/partials/commenting.html index ceb9c59..99d72a4 100644 --- a/layouts/partials/commenting.html +++ b/layouts/partials/commenting.html @@ -1,14 +1,11 @@ - -{{ if .Site.DisqusShortname -}} - {{ if ne .Params.showcomments false }} +{{- if and (not .Site.BuildDrafts) (ne .Params.showcomments false) -}} + {{ if .Site.DisqusShortname -}}

Comments

- {{ partial "commenting_disqus.html" . }} - {{ end }} -{{ else if .Site.Params.GraphCommentId -}} - {{ if ne .Params.showcomments false }} + {{- partial "commenting/disqus.html" . -}} + {{- else if .Site.Params.GraphCommentId -}}

Comments

- {{ partial "commenting_graph.html" . }} - {{ end }} -{{- end }} \ No newline at end of file + {{- partial "commenting/graphcomment.html" . -}} + {{- end -}} +{{- end }} diff --git a/layouts/partials/commenting_disqus.html b/layouts/partials/commenting/disqus.html similarity index 100% rename from layouts/partials/commenting_disqus.html rename to layouts/partials/commenting/disqus.html diff --git a/layouts/partials/commenting_graph.html b/layouts/partials/commenting/graphcomment.html similarity index 100% rename from layouts/partials/commenting_graph.html rename to layouts/partials/commenting/graphcomment.html diff --git a/layouts/partials/content_list.html b/layouts/partials/content_list.html index 42c172d..f0a1550 100644 --- a/layouts/partials/content_list.html +++ b/layouts/partials/content_list.html @@ -1,9 +1,9 @@

{{ .Title }}