digitalcraftsman / hugo-creative-theme

Port of Startbootstrap's Creative theme to Hugo
Apache License 2.0
138 stars 116 forks source link

How to add a privacy page in the footer? #18

Closed Schokolader closed 8 years ago

Schokolader commented 8 years ago

How can I add a privacy page in the end of the site? Sorry I'm very new to hugo and still have to learn a lot... :) How can I link to a page in the content folder?

digitalcraftsman commented 8 years ago

Hello @Schokolader,

take a look at the cross-reference feature. But do you have a template/layout to render single documents from the content folder?

By default the theme doesn't provide such a layout because it's intended as a single-page website.

Schokolader commented 8 years ago

oh thank you for mention that. No at the moment I'm working at your theme to modify it for my website. Then I have to learn how to create that because I like your theme very much. :)

Schokolader commented 8 years ago

I don't get it. I have now a link on my page, but when I open the website its only a white page. What do I have to do that the theme renders my privacy page?

digitalcraftsman commented 8 years ago

I'm sorry. I forgot that the shortcodes that are shown on the linked page are not working in templates. But Hugo has a equivalent template functions called relref and ref.

You can link you content file within a template with {{ ref . "page/privacy.md" }}. This assumes that you use content files to fill the privacy page.

If you hard-code everything in a new template you have to use regular HTML links.

Schokolader commented 8 years ago

ok thank you. But my privacy page is still only a blanc page. I don't know why. I can click on the link and the link seems correct too. But when I open the page I get only a blanc page.

Schokolader commented 8 years ago

is it possible that I have errors in my privacy.md page and hugo does not create a correct file? But I have not much content in the privacy file:


+++
date = "2016-04-29T12:11:59+02:00"

title = "privacy"

+++

test test test
Schokolader commented 8 years ago

I looked at your agency theme how you did the quicklinks there. So I created a footer.html for the creative theme and put that similar to your agency theme in the footer.html:

<div class="col-md-4">
                <ul class="list-inline quicklinks">
                    {{ range .Site.Params.footer.quicklinks }}
                    <li><a href="{{ .link }}">{{ .text  | markdownify }}</a></li>
                    {{ end }}
                </ul>
            </div>

In the config.toml file I included:


[[params.footer.quicklinks]]
                        text = "Terms of Use"
                        link = "pages/privacy"

This gives my website exactly what I wanted. A link to my own privacy page. The problem is, the page is still blanc. What do I miss here? How do I have to tell hugo to render the privacy.md file in my content folder?

digitalcraftsman commented 8 years ago

Single pages like your privacy page are rendered with the template layouts/_default/single.html. I deleted it for this theme because it's (usually) not required. Therefore, your link will open a blank space since Hugo can't find a template to render.

Create this file and add the necessary HTML. You can copy parts of the homepage if you want to keep elements of the design.

Schokolader commented 8 years ago

ok thank you very much. That's it. I'm able now to link to a privacy page.

digitalcraftsman commented 8 years ago

Great to hear that. Can close this issue then?

Schokolader commented 8 years ago

yes! thx!