diff options
author | Curtis Timson <curt@live.co.uk> | 2018-02-24 13:08:37 +0300 |
---|---|---|
committer | Curtis Timson <curt@live.co.uk> | 2018-02-24 13:08:37 +0300 |
commit | cbcfca8e1058619ad90b1147b54eca154bac656c (patch) | |
tree | 3dea9b740e6905015d7d14a0339ca85ec4c40758 | |
parent | e49918d911771db616f49952959d105e232f75b8 (diff) |
:sparkles: Move sidebar content to data
-rw-r--r-- | exampleSite/config-prod.toml | 20 | ||||
-rw-r--r-- | exampleSite/config.toml | 21 | ||||
-rw-r--r-- | exampleSite/data/footer/contactinfo.yaml | 4 | ||||
-rw-r--r-- | exampleSite/data/sidebar/content.yaml | 14 | ||||
-rw-r--r-- | layouts/_default/single.html | 6 | ||||
-rw-r--r-- | layouts/partials/footer/contact.html | 8 | ||||
-rw-r--r-- | layouts/partials/post/sidebar.html | 20 |
7 files changed, 40 insertions, 53 deletions
diff --git a/exampleSite/config-prod.toml b/exampleSite/config-prod.toml index 2eb29b0..fcf2151 100644 --- a/exampleSite/config-prod.toml +++ b/exampleSite/config-prod.toml @@ -18,24 +18,6 @@ theme = "../.." postsperpage = "6" foldername = "blog" -[params.contact] - email = "someone@untitled.tld" - phone = "(800) 000-0000" - [params.settings] googleanalytics = "UA-113904582-2" - disqus = "hugo-dopetrope" - -[params.sidebar] - position = "right" - - image1 = "images/pic09.jpg" - title1 = "Sed etiam lorem nulla" - description1 = "Lorem ipsum dolor sit amet sit veroeros sed amet blandit consequat veroeros lorem blandit adipiscing et feugiat phasellus tempus dolore ipsum lorem dolore." - buttonlink1 = "#" - buttontext1 = "Magna sed taciti" - - title2 = "Feugiat consequat" - description2 = "Veroeros sed amet blandit consequat veroeros lorem blandit adipiscing et feugiat sed lorem consequat feugiat lorem dolore." - buttonlink2 = "#" - buttontext2 = "Ipsum consequat"
\ No newline at end of file + disqus = "hugo-dopetrope"
\ No newline at end of file diff --git a/exampleSite/config.toml b/exampleSite/config.toml index de311e5..8da763e 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -18,25 +18,6 @@ theme = "../.." postsperpage = "6" foldername = "blog" -[params.contact] - email = "someone@untitled.tld" - phone = "(800) 000-0000" - [params.settings] googleanalytics = "UA-113904582-1" - disqus = "hugo-dopetrope" - -[params.sidebar] - position = "right" - - image1 = "images/pic09.jpg" - imagelink1 = "#" - title1 = "Sed etiam lorem nulla" - description1 = "Lorem ipsum dolor sit amet sit veroeros sed amet blandit consequat veroeros lorem blandit adipiscing et feugiat phasellus tempus dolore ipsum lorem dolore." - buttonlink1 = "#" - buttontext1 = "Magna sed taciti" - - title2 = "Feugiat consequat" - description2 = "Veroeros sed amet blandit consequat veroeros lorem blandit adipiscing et feugiat sed lorem consequat feugiat lorem dolore." - buttonlink2 = "#" - buttontext2 = "Ipsum consequat"
\ No newline at end of file + disqus = "hugo-dopetrope"
\ No newline at end of file diff --git a/exampleSite/data/footer/contactinfo.yaml b/exampleSite/data/footer/contactinfo.yaml index 4d3d11b..0414d9d 100644 --- a/exampleSite/data/footer/contactinfo.yaml +++ b/exampleSite/data/footer/contactinfo.yaml @@ -4,3 +4,7 @@ addresslines: - line: '1234 Somewhere Road Suite' - line: 'Nashville, TN 00000-0000' + +email: 'someone@untitled.tld' + +phone: '(800) 000-0000'
\ No newline at end of file diff --git a/exampleSite/data/sidebar/content.yaml b/exampleSite/data/sidebar/content.yaml new file mode 100644 index 0000000..8056f9f --- /dev/null +++ b/exampleSite/data/sidebar/content.yaml @@ -0,0 +1,14 @@ +position: "right" + +sections: +- image: "images/pic09.jpg" + imagelink: "#" + title: "Sed etiam lorem nulla" + description: "Lorem ipsum dolor sit amet sit veroeros sed amet blandit consequat veroeros lorem blandit adipiscing et feugiat phasellus tempus dolore ipsum lorem dolore." + buttonlink: "#" + buttontext: "Magna sed taciti" + +- title: "Feugiat consequat" + description: "Veroeros sed amet blandit consequat veroeros lorem blandit adipiscing et feugiat sed lorem consequat feugiat lorem dolore." + buttonlink: "#" + buttontext: "Ipsum consequat"
\ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html index b4df0e0..cc16d29 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -23,9 +23,9 @@ <!-- Main --> <div id="main-wrapper"> <div class="container"> - {{ if and (or (eq .Site.Params.Sidebar.position "left") (eq .Site.Params.Sidebar.position "right")) (not (eq .Params.hidesidebar true)) }} + {{ if and (or (eq .Site.Data.sidebar.content.position "left") (eq .Site.Data.sidebar.content.position "right")) (not (eq .Params.hidesidebar true)) }} <div class="row"> - {{ if eq .Site.Params.Sidebar.position "left" }} + {{ if eq .Site.Data.sidebar.content.position "left" }} <div class="4u 12u(mobile)"> {{ partial "post/sidebar" . }} </div> @@ -33,7 +33,7 @@ <div class="8u 12u(mobile)"> {{ partial "post/content.html" . }} </div> - {{ if eq .Site.Params.Sidebar.position "right" }} + {{ if eq .Site.Data.sidebar.content.position "right" }} <div class="4u 12u(mobile)"> {{ partial "post/sidebar" . }} </div> diff --git a/layouts/partials/footer/contact.html b/layouts/partials/footer/contact.html index 5ff160b..06bde75 100644 --- a/layouts/partials/footer/contact.html +++ b/layouts/partials/footer/contact.html @@ -11,12 +11,16 @@ </p> </li> {{ end }} + {{ if .Site.Data.footer.contactinfo.email }} <li> <h3>Mail</h3> - <p><a href="mailto:{{ .Site.Params.Contact.email }}">{{ .Site.Params.Contact.email }}</a></p> + <p><a href="mailto:{{ .Site.Data.footer.contactinfo.email }}">{{ .Site.Data.footer.contactinfo.email }}</a></p> </li> + {{ end }} + {{ if .Site.Data.footer.contactinfo.email }} <li> <h3>Phone</h3> - <p>{{ .Site.Params.Contact.phone }}</p> + <p>{{ .Site.Data.footer.contactinfo.phone }}</p> </li> + {{ end }} </ul>
\ No newline at end of file diff --git a/layouts/partials/post/sidebar.html b/layouts/partials/post/sidebar.html index 90a93ef..63b70e4 100644 --- a/layouts/partials/post/sidebar.html +++ b/layouts/partials/post/sidebar.html @@ -1,28 +1,30 @@ -{{ $sidebar := .Site.Params.Sidebar }} +{{ $sidebar := .Site.Data.sidebar.content }} +{{ $sidebarsection1 := index $sidebar.sections 0 }} +{{ $sidebarsection2 := index $sidebar.sections 1 }} <!-- Sidebar --> <section class="box"> - {{ if $sidebar.image1 }} - <a href="{{ $sidebar.imagelink1 }}" class="image featured"><img src="{{ .Site.BaseURL }}{{ $sidebar.image1 }}" alt="" /></a> + {{ if $sidebarsection1.image }} + <a href="{{ $sidebarsection1.imagelink }}" class="image featured"><img src="{{ .Site.BaseURL }}{{ $sidebarsection1.image }}" alt="" /></a> {{ end }} <header> - <h3>{{ $sidebar.title1 }}</h3> + <h3>{{ $sidebarsection1.title }}</h3> </header> - <p>{{ $sidebar.description1 }}</p> + <p>{{ $sidebarsection1.description }}</p> <footer> - <a href="{{ $sidebar.buttonlink1 }}" class="button alt">{{ $sidebar.buttontext1 }}</a> + <a href="{{ $sidebarsection1.buttonlink }}" class="button alt">{{ $sidebarsection1.buttontext }}</a> </footer> </section> <section class="box"> <header> - <h3>{{ $sidebar.title2 }}</h3> + <h3>{{ $sidebarsection2.title }}</h3> </header> - <p>{{ $sidebar.description2 }}</p> + <p>{{ $sidebarsection2.description }}</p> <ul class="divided"> {{ range first 4 (where .Site.Pages "Type" .Site.Params.Blog.foldername) }} <li><a href="{{ .Permalink }}">{{ .Title }}</a></li> {{ end }} </ul> <footer> - <a href="{{ $sidebar.buttonlink2 }}" class="button alt">{{ $sidebar.buttontext2 }}</a> + <a href="{{ $sidebarsection2.buttonlink }}" class="button alt">{{ $sidebarsection2.buttontext }}</a> </footer> </section>
\ No newline at end of file |