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

github.com/schmanat/hugo-highlights-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Chebotarev <vladimir.chebotarev@gmail.com>2018-03-11 19:04:36 +0300
committerVladimir Chebotarev <vladimir.chebotarev@gmail.com>2018-03-11 20:44:47 +0300
commitf222eaab7c42546734a2d406a3e57e68922721e4 (patch)
tree091e14ed4070e494d60b5dfe6cf79704d9c4668e
parent54a7feefe1aeb15dabcad2e3f18cacf02a888123 (diff)
Extensibility improvements: custom sections, reordering and disabling.
-rw-r--r--exampleSite/config.toml64
-rw-r--r--layouts/index.html41
-rw-r--r--layouts/partials/about.html16
-rw-r--r--layouts/partials/contact.html29
-rw-r--r--layouts/partials/footer-contact.html17
-rw-r--r--layouts/partials/footer-social.html4
-rw-r--r--layouts/partials/hero.html10
-rw-r--r--layouts/partials/infos.html15
-rw-r--r--layouts/partials/list.html25
-rw-r--r--layouts/partials/scripts.html16
-rw-r--r--layouts/partials/skills.html23
-rw-r--r--layouts/partials/text.html17
12 files changed, 142 insertions, 135 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 2771375..8ce10df 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -37,15 +37,17 @@ googleAnalytics = ""
# If it's disabled you could change the background to overwrite the bg.png and overlay.png to set the background.
backgroundpersection = true
- # Hero Section
+ # hero Section
[params.hero]
+ type = "hero"
title = "Highlights"
description = "a fun litte { responsive } single Pager by [HTML5UP](//html5up.net)"
buttontext = "begin"
# about section
- [params.about]
- enable = true
+ [[params.block]]
+ id = "about"
+ type = "text"
title = "Who am I"
description = "Aliquam ante ac id. Adipiscing interdum lorem praesent fusce pellentesque arcu feugiat. Consequat sed ultricies rutrum. Sed adipiscing eu amet interdum lorem blandit vis ac commodo aliquet integer vulputate phasellus lorem ipsum dolor lorem magna consequat sed etiam adipiscing interdum."
buttontext = "next"
@@ -53,59 +55,69 @@ googleAnalytics = ""
picture = "pic01.jpg"
# skill section
- [params.skill_list]
- enable = true
+ [[params.block]]
+ id = "skills"
+ type = "list"
title = "Stuff I do"
description = "Consequat sed ultricies rutrum. Sed adipiscing eu amet interdum lorem blandit vis ac commodo aliquet vulputate."
buttontext = "next"
# the picture is storead at static/images/
picture = "pic02.jpg"
- [[params.skills]]
+ [[params.block.item]]
icon = "fa-camera-retro"
title = "Magna Etiam"
- [[params.skills]]
+ [[params.block.item]]
icon = "fa-pencil"
title = "Lorem Ipsum"
- [[params.skills]]
+ [[params.block.item]]
icon = "fa-code"
title = "Nulla Tempus"
- [[params.skills]]
+ [[params.block.item]]
icon = "fa-coffee"
title = "Sed Feugiat"
+
# infos section
- [params.infos]
- enable = true
+ [[params.block]]
+ id = "infos"
+ type = "text"
title = "One more thing"
description = "Aliquam ante ac id. Adipiscing interdum lorem praesent fusce pellentesque arcu feugiat. Consequat sed ultricies rutrum. Sed adipiscing eu amet interdum lorem blandit vis ac commodo aliquet integer vulputate phasellus lorem ipsum dolor lorem magna consequat sed etiam adipiscing interdum."
# the picture is storead at static/images/
picture = "pic03.jpg"
- # footer section
- # this section includes
- #
- # - the contact form
- # - social icons
- #
- # It's possible to disable the whole footer or disable only social icons or contact form
-
- [params.footer]
- enable = true
+# # custom section
+# [[params.block]]
+# id = "important"
+# # to make custom section copy <theme>/layouts/partials/text.html to /layouts/partials/custom.html and edit it according to your needs.
+# type = "custom"
+# title = "Don't forget"
+# description = "Curabitur massa ante, semper at massa et, semper pellentesque velit. Duis tempor est nisi, a gravida risus malesuada eget. Nunc rutrum arcu laoreet mauris sodales vehicula. Nunc iaculis felis ac dui egestas, vel ullamcorper tellus bibendum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque lacinia sem porttitor, fringilla metus at, convallis quam. Integer convallis a justo non pellentesque."
+# # the picture is storead at static/images/
+# picture = "pic04.jpg"
+
+ # contact form
+ [[params.block]]
+ id = "contact"
+ type = "contact"
title = "Get in Touch"
+ picture = "pic05.jpg"
- # contact form
- [params.footer.contact]
- enable = true
-
- [params.footer.contact.form]
+ [params.block.form]
name = "Name"
email = "Your Email"
message = "Your Message"
buttontext = "send message"
+ # footer section
+ # this section includes last block and social icons
+
+ [params.footer]
+ enable = true
+
# social icons
[params.footer.social_list]
enable = true
diff --git a/layouts/index.html b/layouts/index.html
index 70b051f..8281abe 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -9,32 +9,25 @@
{{ partial "head.html" . }}
</head>
<body>
- {{ partial "hero.html" . }}
-
- {{ if .Site.Params.about.enable }}
- {{ partial "about.html" . }}
- {{ end }}
-
- {{ if .Site.Params.skill_list.enable }}
- {{ partial "skills.html" . }}
- {{ end }}
-
- {{ if .Site.Params.infos.enable }}
- {{ partial "infos.html" . }}
- {{ end }}
-
- {{ if .Site.Params.footer.enable }}
-
- {{"<!-- Footer -->" | safeHTML}}
+ {{ $list := .Site.Params.block }}
+ {{ partial "hero.html" (dict "block" .Site.Params.hero "params" $.Site.Params "next" (index $list 0)) }}
+ {{ range $index, $element := $list }}
+ {{ $last := eq $index (sub (len $list) 1) }}
+ {{ if and $.Site.Params.footer.enable $last }}
+ {{"<!-- Footer -->" | safeHTML}}
<section id="footer">
- {{ if .Site.Params.footer.contact.enable }}
- {{ partial "footer-contact.html" . }}
- {{ end }}
-
- {{ if .Site.Params.footer.social_list.enable }}
- {{ partial "footer-social.html" . }}
+ {{ end }}
+ {{ if $last }}
+ {{ partial (print $element.type ".html") (dict "block" $element "params" $.Site.Params) }}
+ {{ else }}
+ {{ partial (print $element.type ".html") (dict "block" $element "params" $.Site.Params "next" (index $list (add $index 1))) }}
+ {{ end }}
+ {{ if and $.Site.Params.footer.enable $last }}
+ {{ if $.Site.Params.footer.social_list.enable }}
+ {{ partial "footer-social.html" $.Site.Params.footer }}
{{ end }}
- </section>
+ </section>
+ {{ end }}
{{ end }}
{{ partial "scripts.html" . }}
diff --git a/layouts/partials/about.html b/layouts/partials/about.html
deleted file mode 100644
index ad09814..0000000
--- a/layouts/partials/about.html
+++ /dev/null
@@ -1,16 +0,0 @@
-
-{{ "<!-- about -->" | safeHTML }}
- <section id="about" class="main special">
- <div class="container">
- {{ if eq .Site.Params.backgroundpersection true }}
- <span class="image fit primary"><img src="images/{{ with .Site.Params.about.picture }}{{ . }}{{ end }}" alt="" /></span>
- {{ end }}
- <div class="content">
- <header class="major">
- <h2>{{ with .Site.Params.about.title }}{{ . | markdownify }}{{ end }}</h2>
- </header>
- <p>{{ with .Site.Params.about.description }}{{ . | markdownify }}{{ end }}</p>
- </div>
- <a href="#skills" class="goto-next scrolly">{{ with .Site.Params.about.buttontext }}{{ . | markdownify }}{{ end }}</a>
- </div>
- </section>
diff --git a/layouts/partials/contact.html b/layouts/partials/contact.html
new file mode 100644
index 0000000..8a4bc7f
--- /dev/null
+++ b/layouts/partials/contact.html
@@ -0,0 +1,29 @@
+{{ print "<!-- " .block.id " -->" | safeHTML }}
+<section id="{{.block.id}}" class="main special">
+ <div class="container">
+ {{ if eq .params.backgroundpersection true }}
+ <span class="image fit primary"><img src="images/{{ with .block.picture }}{{ . }}{{ end }}" alt="" /></span>
+ {{ end }}
+ <div class="content">
+ <header class="major">
+ <h2>{{ with .block.title }}{{ . | markdownify }}{{ end }}</h2>
+ </header>
+ <p>{{ with .block.description }}{{ . | markdownify }}{{ end }}</p>
+ <form method="post" action="//formspree.io/{{ with .params.email }}{{.}}{{ end }}">
+ <div class="row uniform">
+ <div class="6u 12u$(xsmall)"><input type="text" name="name" id="name" placeholder="{{ with .block.form.name }}{{ . }}{{ end }}" /></div>
+ <div class="6u$ 12u$(xsmall)"><input type="email" name="email" id="email" placeholder="{{ with .block.form.email }}{{ . }}{{ end }}" /></div>
+ <div class="12u$"><textarea name="message" id="message" placeholder="{{ with .block.form.message }}{{ . }}{{ end }}" rows="4"></textarea></div>
+ <div class="12u$">
+ <ul class="actions">
+ <li><input type="submit" value="{{ with .block.form.buttontext }}{{ . }}{{ end }}" class="special" /></li>
+ </ul>
+ </div>
+ </div>
+ </form>
+ </div>
+ {{ if .next }}
+ <a href="#{{.next.id}}" class="goto-next scrolly">{{ with .block.buttontext }}{{ . | markdownify }}{{ end }}</a>
+ {{ end }}
+ </div>
+</section>
diff --git a/layouts/partials/footer-contact.html b/layouts/partials/footer-contact.html
deleted file mode 100644
index 2e4b302..0000000
--- a/layouts/partials/footer-contact.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<div class="container">
- <header class="major">
- <h2>{{ with .Site.Params.footer.title }}{{ . | markdownify }}{{ end }}</h2>
- </header>
- <form method="post" action="//formspree.io/{{ with .Site.Params.email }}{{.}}{{ end }}">
- <div class="row uniform">
- <div class="6u 12u$(xsmall)"><input type="text" name="name" id="name" placeholder="{{ with .Site.Params.footer.contact.form.name }}{{ . }}{{ end }}" /></div>
- <div class="6u$ 12u$(xsmall)"><input type="email" name="email" id="email" placeholder="{{ with .Site.Params.footer.contact.form.email }}{{ . }}{{ end }}" /></div>
- <div class="12u$"><textarea name="message" id="message" placeholder="{{ with .Site.Params.footer.contact.form.message }}{{ . }}{{ end }}" rows="4"></textarea></div>
- <div class="12u$">
- <ul class="actions">
- <li><input type="submit" value="{{ with .Site.Params.footer.contact.form.buttontext }}{{ . }}{{ end }}" class="special" /></li>
- </ul>
- </div>
- </div>
- </form>
-</div>
diff --git a/layouts/partials/footer-social.html b/layouts/partials/footer-social.html
index a2e2765..5e56bd5 100644
--- a/layouts/partials/footer-social.html
+++ b/layouts/partials/footer-social.html
@@ -1,11 +1,11 @@
<footer>
<ul class="icons">
- {{ range .Site.Params.footer.social }}
+ {{ range .social }}
<li><a href="{{ .link }}" class="icon alt {{ .icon }}"><span class="label">{{ .title }}</span></a></li>
{{ end }}
</ul>
<ul class="copyright">
- {{ range .Site.Params.footer.copyright.notice }}
+ {{ range .copyright.notice }}
<li>{{ .text | markdownify }}</li>
{{ end }}
</ul>
diff --git a/layouts/partials/hero.html b/layouts/partials/hero.html
index 40c2357..b332164 100644
--- a/layouts/partials/hero.html
+++ b/layouts/partials/hero.html
@@ -1,12 +1,14 @@
-{{ "<!-- Hero -->" | safeHTML}}
+{{ "<!-- header -->" | safeHTML}}
<section id="header">
<header class="major 1">
- <h1>{{ with .Site.Params.hero.title }} {{ . | markdownify }} {{ end }}</h1>
- <p>{{ with .Site.Params.hero.description }} {{ . | markdownify }} {{ end }}</p>
+ <h1>{{ with $.block.title }} {{ . | markdownify }} {{ end }}</h1>
+ <p>{{ with $.block.description }} {{ . | markdownify }} {{ end }}</p>
</header>
<div class="container">
<ul class="actions">
- <li><a href="#about" class="button special scrolly">{{ with .Site.Params.hero.buttontext }} {{ . | markdownify }} {{ end }}</a></li>
+ {{ if .next }}
+ <li><a href="#{{.next.id}}" class="button special scrolly">{{ with .block.buttontext }}{{ . | markdownify }}{{ end }}</a></li>
+ {{ end }}
</ul>
</div>
</section>
diff --git a/layouts/partials/infos.html b/layouts/partials/infos.html
deleted file mode 100644
index d8750d5..0000000
--- a/layouts/partials/infos.html
+++ /dev/null
@@ -1,15 +0,0 @@
-{{ "<!-- Infos -->" | safeHTML }}
- <section id="infos" class="main special">
- <div class="container">
- {{ if eq .Site.Params.backgroundpersection true }}
- <span class="image fit primary"><img src="images/{{ with .Site.Params.infos.picture }}{{ . }}{{ end }}" alt="" /></span>
- {{ end }}
- <div class="content">
- <header class="major">
- <h2>{{ with .Site.Params.infos.title}}{{ . | markdownify }}{{ end }}</h2>
- </header>
- <p>{{ with .Site.Params.infos.description }}{{ . | markdownify }}{{ end }}</p>
- </div>
- <a href="#footer" class="goto-next scrolly">{{ with .Site.Params.infos.buttontext }}{{ . | markdownify }}{{ end }}</a>
- </div>
- </section>
diff --git a/layouts/partials/list.html b/layouts/partials/list.html
new file mode 100644
index 0000000..7f1c87d
--- /dev/null
+++ b/layouts/partials/list.html
@@ -0,0 +1,25 @@
+{{ print "<!-- " .block.id " -->" | safeHTML }}
+<section id="{{.block.id}}" class="main special">
+ <div class="container">
+ {{ if eq .params.backgroundpersection true }}
+ <span class="image fit primary"><img src="images/{{ with .block.picture }}{{ . }}{{ end }}" alt="" /></span>
+ {{ end }}
+ <div class="content">
+ <header class="major">
+ <h2>{{ with .block.title}}{{ . | markdownify }}{{ end }}</h2>
+ </header>
+ <p>{{ with .block.description}}{{ . | markdownify }}{{ end }}</p>
+ <ul class="icons-grid">
+ {{ range .block.item }}
+ <li>
+ <span class="icon major {{ .icon }}"></span>
+ <h3>{{ .title }}</h3>
+ </li>
+ {{ end }}
+ </ul>
+ </div>
+ {{ if .next }}
+ <a href="#{{.next.id}}" class="goto-next scrolly">{{ with .block.buttontext }}{{ . | markdownify }}{{ end }}</a>
+ {{ end }}
+ </div>
+</section>
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html
index a0f8fa6..cba53d0 100644
--- a/layouts/partials/scripts.html
+++ b/layouts/partials/scripts.html
@@ -1,9 +1,9 @@
{{ "<!-- Scripts -->" | safeHTML }}
- <script src="{{ .Site.BaseURL }}js/jquery.min.js"></script>
- <script src="{{ .Site.BaseURL }}js/jquery.scrollex.min.js"></script>
- <script src="{{ .Site.BaseURL }}js/jquery.scrolly.min.js"></script>
- <script src="{{ .Site.BaseURL }}js/skel.min.js"></script>
- <script src="{{ .Site.BaseURL }}js/util.js"></script>
- {{ "<!-- [if lte IE 8 ]]> <script src=" | safeHTML }}"{{ .Site.BaseURL }}{{ "js/ie/respond.min.js\"></script><![endif] -->" | safeHTML }}
- <script src="{{ .Site.BaseURL }}js/main.js"></script>
- {{ template "_internal/google_analytics.html" . }}
+<script src="{{ .Site.BaseURL }}js/jquery.min.js"></script>
+<script src="{{ .Site.BaseURL }}js/jquery.scrollex.min.js"></script>
+<script src="{{ .Site.BaseURL }}js/jquery.scrolly.min.js"></script>
+<script src="{{ .Site.BaseURL }}js/skel.min.js"></script>
+<script src="{{ .Site.BaseURL }}js/util.js"></script>
+{{ "<!-- [if lte IE 8 ]]> <script src=" | safeHTML }}"{{ .Site.BaseURL }}{{ "js/ie/respond.min.js\"></script><![endif] -->" | safeHTML }}
+<script src="{{ .Site.BaseURL }}js/main.js"></script>
+{{ template "_internal/google_analytics.html" . }}
diff --git a/layouts/partials/skills.html b/layouts/partials/skills.html
deleted file mode 100644
index 1a8fa66..0000000
--- a/layouts/partials/skills.html
+++ /dev/null
@@ -1,23 +0,0 @@
-{{ "<!-- Services -->" | safeHTML }}
- <section id="skills" class="main special">
- <div class="container">
- {{ if eq .Site.Params.backgroundpersection true }}
- <span class="image fit primary"><img src="images/{{ with .Site.Params.skill_list.picture }}{{ . }}{{ end }}" alt="" /></span>
- {{ end }}
- <div class="content">
- <header class="major">
- <h2>{{ with .Site.Params.skill_list.title}}{{ . | markdownify }}{{ end }}</h2>
- </header>
- <p>{{ with .Site.Params.skill_list.description}}{{ . | markdownify }}{{ end }}</p>
- <ul class="icons-grid">
- {{ range .Site.Params.skills }}
- <li>
- <span class="icon major {{ .icon }}"></span>
- <h3>{{ .title }}</h3>
- </li>
- {{ end }}
- </ul>
- </div>
- <a href="#infos" class="goto-next scrolly">{{ with .Site.Params.skill_list.buttontext }}{{ . | markdownify }}{{ end }}</a>
- </div>
- </section>
diff --git a/layouts/partials/text.html b/layouts/partials/text.html
new file mode 100644
index 0000000..4818287
--- /dev/null
+++ b/layouts/partials/text.html
@@ -0,0 +1,17 @@
+{{ print "<!-- " .block.id " -->" | safeHTML }}
+<section id="{{.block.id}}" class="main special">
+ <div class="container">
+ {{ if eq .params.backgroundpersection true }}
+ <span class="image fit primary"><img src="images/{{ with .block.picture }}{{ . }}{{ end }}" alt="" /></span>
+ {{ end }}
+ <div class="content">
+ <header class="major">
+ <h2>{{ with .block.title }}{{ . | markdownify }}{{ end }}</h2>
+ </header>
+ <p>{{ with .block.description }}{{ . | markdownify }}{{ end }}</p>
+ </div>
+ {{ if .next }}
+ <a href="#{{.next.id}}" class="goto-next scrolly">{{ with .block.buttontext }}{{ . | markdownify }}{{ end }}</a>
+ {{ end }}
+ </div>
+</section>