diff --git a/CHANGELOG.md b/CHANGELOG.md index e6fa73a..82b1e83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,4 +2,7 @@ ## Version 1.0 -- Fork from [Hyde](https://github.com/spf13/hyde) and adapt to [Nate Finch's blog](https://npf.io)'s colors and fonts. \ No newline at end of file +- Fork from [Hyde](https://github.com/spf13/hyde) +- Adapt to [Nate Finch's blog](https://npf.io)'s colors and fonts. +- Refactor `basedof.html` and corresponding pages `index.html`, `single.html`, `list.html` + - define blocks `content` and `footer` that will be fulfilled by each different type of layout. \ No newline at end of file diff --git a/layouts/404.html b/layouts/404.html index a919514..e76d3fe 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,4 +1,11 @@ -{{ define "main" -}} +{{ define "header" -}} + {{ partial "header.html" . }} +{{- end }} + +{{ define "content" -}}

404: Page not found

Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. Head back home to try finding it again.

+{{- end }} + +{{ define "footer" -}} {{- end }} \ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index c7ed356..3b77bea 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,11 +1,19 @@ -{{ partial "head.html" . }} - - {{ partial "sidebar.html" . }} -
- {{ block "main" . }}{{ end }} - -
- - \ No newline at end of file + + + + {{ block "header" . }}{{ end }} + + + {{ partial "sidebar.html" . }} +
+ {{ block "content" . }}{{ end }} + +
+ + {{ if .Site.GoogleAnalytics -}} + {{ template "_internal/google_analytics_async.html" . }} + {{- end }} + + diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 320a629..adc8874 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,18 +1,10 @@ -{{ define "main" }} -

{{ .Title }}

- -{{- end }} +{{ define "header" -}} + {{ partial "header.html" . }} +{{- end -}} -{{ define "footer" }} - - {{ if .Site.GoogleAnalytics -}} - {{ template "_internal/google_analytics_async.html" . }} - {{- end}} - -{{- end }} \ No newline at end of file +{{ define "content" -}} + {{ partial "list_content.html" . }} +{{- end -}} + +{{ define "footer" -}} +{{- end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 1103e80..e91d36e 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,63 +1,11 @@ -{{ define "main" -}} -
-

{{ .Title }}

- {{ if ne .Params.showpagemeta false }} -
- -
- {{ end }} - {{ .Content }} -
-{{- end }} +{{ define "header" -}} + {{ partial "header.html" . }} +{{- end -}} + +{{ define "content" -}} + {{ partial "post_content.html" . }} +{{- end -}} {{ define "footer" -}} - {{ if .Site.Params.highlightjs }} - - {{ range .Site.Params.highlightjslanguages }} - - {{ end }} - - {{ end }} - - {{ if .Site.GoogleAnalytics }} - {{ template "_internal/google_analytics_async.html" . }} - {{ end }} - - {{ if .Site.DisqusShortname }} - {{ if ne .Params.showcomments false }} -

Comments

- {{ partial "disqus.html" . }} - {{ end }} - {{ end }} - - -{{- end }} + {{ partial "post_footer.html" . }} +{{- end -}} diff --git a/static/css/main.css b/layouts/_default/summary.html similarity index 100% rename from static/css/main.css rename to layouts/_default/summary.html diff --git a/layouts/index.html b/layouts/index.html index 2430d53..f882cf1 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,18 +1,23 @@ -{{ define "main" -}} -
-{{ range .Data.Pages -}} -
-

- {{ .Title }} -

- - {{ .Content }} - {{ if .Truncated }} - - {{ end }} -
+{{ define "header" -}} + {{ partial "header.html" . }} {{- end }} -
+ +{{ define "content" -}} +
+ {{ range .Data.Pages -}} +
+

{{ .Title }}

+ + {{ .Summary }} + {{ if .Truncated }} + + {{ end }} +
+ {{- end }} +
+{{- end }} + +{{ define "footer" -}} {{- end }} \ No newline at end of file diff --git a/layouts/partials/code_header.html b/layouts/partials/code_header.html new file mode 100644 index 0000000..c7db1a0 --- /dev/null +++ b/layouts/partials/code_header.html @@ -0,0 +1,36 @@ + + + + +{{ with .Site.Params.meta.description }}{{ end }} +{{ with .Site.Params.meta.keywords }}{{ end }} +{{ .Hugo.Generator }} + + +{{ if .IsHome -}} + {{ .Site.Title }} +{{- else -}} + {{ .Title }} · {{ .Site.Title }} +{{- end }} + + + + + + + + + + + + + + + + + + + diff --git a/layouts/partials/head.html b/layouts/partials/head.html deleted file mode 100644 index 859f761..0000000 --- a/layouts/partials/head.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - {{ with .Site.Params.meta.description }}{{ end }} - {{ with .Site.Params.meta.keywords }}{{ end }} - {{ .Hugo.Generator }} - - - {{ if .IsHome -}} - {{ .Site.Title }} - {{- else -}} - {{ .Title }} · {{ .Site.Title }} - {{- end }} - - - - - - - - - {{ if .Site.Params.highlightjs }} - - {{ end }} - - - - - - - - - - - diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 0000000..7359db7 --- /dev/null +++ b/layouts/partials/header.html @@ -0,0 +1,43 @@ + + + + +{{ with .Site.Params.meta.description }}{{ end }} +{{ with .Site.Params.meta.keywords }}{{ end }} +{{ .Hugo.Generator }} + + +{{ if .IsHome -}} + {{ .Site.Title }} +{{- else -}} + {{ .Title }} · {{ .Site.Title }} +{{- end }} + + + + + + + + +{{ if .Site.Params.highlightjs }} + +{{ end }} + + +{{ if .Site.Params.PygmentsUseClasses }} + +{{ end }} + + + + + + + + + + diff --git a/layouts/partials/list_content.html b/layouts/partials/list_content.html new file mode 100644 index 0000000..f43c65d --- /dev/null +++ b/layouts/partials/list_content.html @@ -0,0 +1,11 @@ +

{{ .Title }}

+ diff --git a/layouts/partials/post_content.html b/layouts/partials/post_content.html new file mode 100644 index 0000000..a02de2b --- /dev/null +++ b/layouts/partials/post_content.html @@ -0,0 +1,35 @@ +
+

{{ .Title }}

+ {{ if ne .Params.showpagemeta false }} +
+ +
+ {{ end }} + {{ .Content }} +
\ No newline at end of file diff --git a/layouts/partials/disqus.html b/layouts/partials/post_disqus.html similarity index 52% rename from layouts/partials/disqus.html rename to layouts/partials/post_disqus.html index 231eeec..437a303 100644 --- a/layouts/partials/disqus.html +++ b/layouts/partials/post_disqus.html @@ -1,10 +1,14 @@
-