steakpi
steakpi

Reputation: 953

Basic Template in Hippo CMS

Good Morning,

I am trying to get a grip of understanding how Hippo and the HST tier work.

I have followed both the Hello World and the Go Green tutorials but I'm still struggling to grasp what I'm doing in the console.

Here is what I want to do.

I have the following files:

My base-layout.ftl file looks like this:

<!doctype html>

<#assign hst=JspTaglibs["http://www.hippoecm.org/jsp/hst/core"] >
<#assign fmt=JspTaglibs ["http://java.sun.com/jsp/jstl/fmt"] >

<html>
<head>
    <title>Base Layout</title>
    <meta charset="utf-8">

    <@hst.headContributions categoryIncludes="htmlHead" xhtml=true/>

</head>
<body>

    <section>
        <@hst.include ref="main"/>
    </section>

    <section>
         <footer>
            <@hst.include ref="footer"/>
         </footer>
    </section>



    <@hst.headContributions categoryIncludes="htmlBodyEnd" xhtml=true/>

</body>
</html>

My base-footer.ftl looks like this:

<@hst.include ref="container"/>
<p>Footer Content</p>
  1. How do I set up the base-layout to consume the base-footer
  2. How can I then create "pages/documents" via the cms that use this base-layout to populate the freemarker code here <@hst.include ref="main"/>

Look forward to any help

Thanks

Upvotes: 0

Views: 879

Answers (1)

Jasper Floor
Jasper Floor

Reputation: 553

In the console under hst:configurations/myhippoproject (or gogreen, common...) you will see nodes like hst:pages and hst:components (they are basically the same, the difference is for historical reasons). Under that you will find a structure like

page
    header
    main
    footer

Now any of these nodes may refer to another node as a reference component and any of them can have a template reference and/or a component class. The template is what will be rendered.

Let's say you have a configuration like

mypage
    main

and mypage references page from above. It should now get both the header and footer from page, but overrides the main. Indeed the main from page could just be an empty placeholder. page most likely has a template with hst.include tags for header, main and footer. These includes are important as well as having the nodes header, main and footer.

In order to link this to pages in the cms you need to add a sitemap item which links urls to both documents and page configurations. Though documents aren't even a requirement.

To be able to create pages from the channel manager you need add a page configuration in hst:prototypepages. These are mostly the same as page configurations but allow for some extra metadata information. This gets a bit to involved to explain here so I suggest you check the documentation and then ask for help on more specific issues. It can be found here:

https://www.onehippo.org/library/concepts/hst-configuration-model/prototypepages-configuration.html

I suggest you also take a look here:

https://www.onehippo.org/trails/deep-dive/hello-world.html

These are tutorials based on an archetype project which is empty and a tool to help add basic functionality and some demo content. They are easy to follow and build up from simple concepts. You can jump in at any point but they build up from previous exercises so if you are not yet comfortable with the concepts it is best to follow them in order

Of course feel free to keep asking questions as well.

Upvotes: 1

Related Questions