setting up the blog area of a hugo Site create a directory in the content directory called blog. add a section (in this case blog) index page using hugo command of hugo new blog/_index.md in this page you only need to have the front matter add new blog content pages. can use hugo command of hugo new blog/blogtitile.md add content in markdown to the new md file create a similar folder structure in the layouts directory to that in the content directory ( “/layouts/blog/” similar to “/content/blog/”) create a list.
What are partials? Partials are chunks of code that you will use multiple times throughout your site. The header or nav or even footer are the most common ones.
Rather than having to code these in every page you simply code them once. This also helps a lot if you need to change them after you have them in many pages.
How and when to use them. It makes sense to create a partial every time you think you may need to use this code in more than one place.
how to create a static page that is not the index page.
Create a flow chart of the process :)
Create new content page - /content/pagename.md ensure you add the following variables to the front matter: type: “static” (set this to anything you like but for static pages “static” just makes sense) page: “static/single.html” (this will be a link to a template file the page will be rendered using) title: “Your short page title” # Make it short as this is used in the automated nav as link text description: “A longer title if you like” # You can use this as the actual page title in the browser and page date: 2017-08-20T18:56:24+01:00 (added automatically if you use the hugo new command to create the page) draft: false (This is a switch to make post/page live or not - false = live, true = not live) Create a static directory in the layouts folder Create a template file in the static folder
Mac Installing on a mac could not be easier with brew. If you do not have brew installed you can follow the instructions at https://brew.sh/
Step 1 install hugo via brew:
brew install hugo and abracadabra thats it!
other platforms To install hugo using windows or linux head to https://gohugo.io/getting-started/installing/ to see the detailed instrauctions.
Config file This file is essential to getting your hugo site set up correctly.
A simple hugo site to capture how to learn HUGO. The content for this home page comes from /content/_index.md the page itself has a layout in the layouts folder called index.html.
the index looks like:
{{ partial "homepage-header.html" . }} {{ .Content }} <p>The /layouts/index.html can also contain content in html format!</p> {{ partial "footer.html" . }} The index.html sets out the structure of the page:
firstly it calls in the common header content which we create asa partial (/partial/homepage-header.
A simple hugo site to capture how to learn HUGO. The content for this home page comes from /content/_index.md the page itself has a layout in the layouts folder called index.html.
the index looks like:
{{ partial "homepage-header.html" . }} {{ .Content }} <p>The /layouts/index.html can also contain content in html format!</p> {{ partial "footer.html" . }} The index.html sets out the structure of the page:
firstly it calls in the common header content which we create asa partial (/partial/homepage-header.