Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/curttimson/hugo-theme-massively.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCurtis Timson <curt@live.co.uk>2018-06-04 20:47:39 +0300
committerCurtis Timson <curt@live.co.uk>2018-06-04 20:47:39 +0300
commit7227a66c0427213ce61e0cc59806f4a166f01347 (patch)
treef6834b3e4080234bba6ae16a9a4a8ab105cdb949
parent63a2c28f5d7dbd4e309291e7d30e08d2fc490731 (diff)
Add default values for post settings
-rw-r--r--exampleSite/config-prod.toml13
-rw-r--r--exampleSite/config.toml9
-rw-r--r--layouts/index.html15
-rw-r--r--package.json2
4 files changed, 24 insertions, 15 deletions
diff --git a/exampleSite/config-prod.toml b/exampleSite/config-prod.toml
index 3888702..f7b7c87 100644
--- a/exampleSite/config-prod.toml
+++ b/exampleSite/config-prod.toml
@@ -3,10 +3,15 @@ title = "Massively"
baseURL = "https://hugo-theme-massively.netlify.com/"
theme = "../.."
-[params.posts]
- foldername = "post"
- pagesize = "6"
- featuredpost = "true"
+# [params]
+ # set below parameter to define a favicon
+ # favicon = "favicon.ico"
+
+# Below parameters can be set to override default post settings
+# [params.posts]
+# foldername = "post"
+# pagesize = "6"
+# featuredpost = "true"
[params.settings]
googleanalytics = "UA-113904582-4"
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 4b20b74..4e4cbd0 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -7,10 +7,11 @@ theme = "../.."
# set below parameter to define a favicon
# favicon = "favicon.ico"
-[params.posts]
- foldername = "post"
- pagesize = "6"
- featuredpost = "true"
+# Below parameters can be set to override default post settings
+# [params.posts]
+# foldername = "post"
+# pagesize = "6"
+# featuredpost = "true"
[params.settings]
googleanalytics = "UA-113904582-3"
diff --git a/layouts/index.html b/layouts/index.html
index 237d062..b45fb1c 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -1,21 +1,24 @@
{{ partial "htmlhead" . }}
<body lang='{{ .Site.Language.Lang | default "en-us" }}' class="is-loading">
- {{ $posts := where .Data.Pages "Type" .Site.Params.Posts.foldername }}
- {{ $firstPost := first 1 $posts }}
+ {{ $postsFoldername := .Site.Params.Posts.foldername | default "post" }}
+ {{ $postsPageSize := .Site.Params.Posts.pagesize | default 6 }}
+ {{ $postsFeaturedPost := .Site.Params.Posts.featuredpost | default "true" }}
+ {{ $posts := where .Data.Pages "Type" $postsFoldername }}
+ {{ $firstPost := first 1 $posts }}
- {{ if and (eq .Site.Params.Posts.featuredpost "true") (gt (len $posts) 1) }}
+ {{ if and (eq $postsFeaturedPost "true") (gt (len $posts) 1) }}
{{ .Scratch.Set "postsForPaging" (after 1 $posts) }}
{{ else }}
{{ .Scratch.Set "postsForPaging" $posts }}
{{ end }}
{{ $postsForPaging := .Scratch.Get "postsForPaging" }}
- {{ $postsPaging := .Paginate $postsForPaging .Site.Params.Posts.pagesize }}
+ {{ $postsPaging := .Paginate $postsForPaging $postsPageSize }}
<!-- Wrapper -->
- <div id="wrapper" class="fade-in">
+ <div id="wrapper" class="fade-in" data-pfn="{{ $postsFoldername }}" data-ps="{{ $postsPageSize }}" data-pfp="{{ $postsFeaturedPost }}">
{{ if eq $postsPaging.PageNumber 1 }}
{{ partial "intro.html" . }}
@@ -27,7 +30,7 @@
<!-- Main -->
<div id="main">
- {{ if eq .Site.Params.Posts.featuredpost "true" }}
+ {{ if eq $postsFeaturedPost "true" }}
{{ partial "posts/featured.html" (dict "firstpost" $firstPost "siteData" (index .Site.Data .Site.Language.Lang)) }}
{{ end }}
{{ partial "posts/list.html" (dict "posts" $postsPaging "siteData" (index .Site.Data .Site.Language.Lang)) }}
diff --git a/package.json b/package.json
index 9ce7545..9a689ef 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "hugo-theme-massively",
- "version": "2.2.0",
+ "version": "2.2.1",
"description": "HTML5 UP theme Massively for Hugo",
"main": "index.js",
"scripts": {