Adding various blocks into template

Hi All,

New to using hugo, but I’ve been building websites for around 10 years, know html/css pretty well, started using wordpress 7 years ago and got lazy, been doing some SEO for the past year on a website and have some great results but cant get the big keywords, site speed is something I really want to improve and using Hugo is how I plan to do it. I have already deployed the test site onto a server and without gzip etc it’s already so much better, I’m upset with myself for not looking into hugo sooner!

Anyway, enough talk. I have setup 2 new pages, and starting re-templating them to suit the business. I have the with the main content in it, the template file (single.html) I have adjusted it to pull in a partial for a sidebar / callback form. I have also used a partial to create some generic content which will be featured on the majority of these pages.

So far so good. The Issue I have at the moment is the page layout has a header block/slideslow. It will be the same on each page but I plan on the writing and image changing per page. I can use {{ .Title }} for the H1, but I was hoping there would be some sort of short description variable, or even set up a custom variable to pull this in. I have attached an image of what I want to achieve.

My aim is to have the header block setup in the variables somewhere, the main content pulling in from and then I can use partials to build the remainder of the page. I’m just unsure how I can achieve this at the moment, or atleast the best way of doing this. I think either the variables or somehow creating a and pulling it into the template, but that seems a little overkill.

Appreciate any help, I’m planning on doing this quite quick, website is around 90 pages, 6/7 different templates needed and the wordpress hosting needs to be renewed early Feb, with the initial test results being so much better on a rubbish cheap server I’m looking forward to seeing what we can achieve.


.Description is one of the predefined Page Variables but one can always use whatever custom parameter they need and then invoke it in the templates for example with .Params.myCustomTitle.

The way I would do it would be to use a Partial Template on the Single Page Templae.

Also I would organize the content in Page Bundles and fetch the PNG Image Page Resource with the relevant Methods.

1 Like

Thanks, I had looked a .Params several times but just didn’t even think. It’s in and workind as expected now.

The header will be moved to a partial. I’m hoping I can build pages quite quickly, in my hunt for peak performance I want to go through every single bit of content and make sure everything is done properly moving forwards

thanks for the help :slight_smile:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.