[solved]Is a theme a requirement?

I am not skilled on hugo io. I have used the quickstart instructions on a linux computer. I was able to start hugo server and the selected theme hugo scroll displayed. The content I had added did not. In hugo new about.md I had added some text.

Is a theme a requirement? I want to get a scroll one page website. Which theme should I select?

1 Like

@joo A theme is sort-of required, because Hugo needs to know a layout/template that should be used to render your content.

In order to choose a theme I would take a look a the themes page. Choose a theme and that fits your needs. You could alternatively write your own templates as a part of a theme but I think you try existing ones before.

You can start with a theme, and copy its files into your project’s local folder, if you want to change the design. Those files will override what’s in your selected theme.

I started that way, but now don’t even specify a theme in the config since all the files are in the right place.

The answer to your question is “No.” A theme is not required. Layouts (templates) are required, however. Themes are just an easy way to get a complete set of layout templates without having to start from scratch.

3 Likes

Thank you. How do I get a page that I can put text into?

hugo new site /path/to/site
cd /path/to/site

git clone https://github.com/gizak/nofancy.git

Then how do I start the theme with my text?

I’m new to Hugo and I followed the quick start guide and applied the Hyde theme as instructed, but I’ve since changed to making my own “layouts” from scratch so that I only get what I need. This is also forcing me to learn about the templating as I go.

If you definitely want to start with a theme, you’ll need to figure out how the theme is made so that you can set your content accordingly. (Or change the theme to match your content structure.)

The nofancy theme folder needs to be inside the themes folder of your project. See the Installing Themes documentation. You can tell Hugo which theme to use from the command line (hugo -t nofancy) or set the theme parameter in your site config.

$ hugo new site fancy

$ cd fancy

$ mkdir themes
$ cd themes
$ git clone https://github.com/gizak/nofancy.git
Cloning into 'nofancy'...
remote: Counting objects: 247, done.
remote: Total 247 (delta 0), reused 0 (delta 0), pack-reused 247
Receiving objects: 100% (247/247), 2.06 MiB | 3.31 MiB/s, done.
Resolving deltas: 100% (98/98), done.
Checking connectivity... done.

$ ls -l
total 0
drwxr-xr-x  11 mdhender  wheel  374 Nov 29 00:41 nofancy

$ ls -l nofancy/
total 24
-rw-r--r--  1 mdhender  wheel  1076 Nov 29 00:41 LICENSE
-rw-r--r--  1 mdhender  wheel  2160 Nov 29 00:41 README.md
drwxr-xr-x  3 mdhender  wheel   102 Nov 29 00:41 archetypes
drwxr-xr-x  7 mdhender  wheel   238 Nov 29 00:41 images
drwxr-xr-x  5 mdhender  wheel   170 Nov 29 00:41 layouts
drwxr-xr-x  5 mdhender  wheel   170 Nov 29 00:41 static
-rw-r--r--  1 mdhender  wheel   343 Nov 29 00:41 theme.toml

$ cd ..
$ echo 'theme = "nofancy"' >> config.toml 

$ hugo new post/first-post.md
/tmp/fancy/content/post/first-post.md created

$ echo 'Quis in diam felis, egestas vel efficitur porta.' >> content/post/first-post.md 
$ cat content/post/first-post.md 
+++
categories = ["misc"]
date = "2015-11-29T00:42:47-06:00"
title = "first post"

+++

Quis in diam felis, egestas vel efficitur porta.

$ hugo
0 draft content
0 future content
1 pages created
0 paginator pages created
0 tags created
1 categories created
in 10 ms

$ ls -l public/post/first-post/index.html 
-rw-r--r--  1 mdhender  wheel  4588 Nov 29 00:43 public/post/first-post/index.html

Thanks.
I am not skilled on this.
I have now erased everthing and started over.
I have done this.

1 Created a folder named ‘website’ in the homefolder.
2 hugo new site /home/pc/website
3 cd /home/pc/website
4 mkdir themes
5 cd themes
6 git clone GitHub - gizak/nofancy: A Hugo blog theme
7 cd /home/pc/website
8 hugo new about.md

I edited about.md to

+++
date = “2015-11-29T15:52:19+01:00”
draft = true
title = “about”

+++

text for website

This is the config.toml file

baseurl = “http://replace-this-with-your-hugo-site.com/”
languageCode = “en-us”
title = “My New Hugo Site”

If I run hugo server the website does not show in the webbrowser.

If I shall edit the config.toml file, then to what?

@joo, no problem.

Either run hugo server -t nofancy or add the following to your config.toml file:

theme = "nofancy"

Then run hugo server. My preference is to update the configuration file.

You should then be able to open http://localhost:1313/ in your browser.

Thank you. This is the /home/pc/website/content about.md file

+++
date = “2015-11-29T15:52:19+01:00”
draft = true
title = “about”

+++

text for website

This is the /home/pc/website config.toml file

baseurl = “http://replace-this-with-your-hugo-site.com/”
languageCode = “en-us”
title = “My New Hugo Site”
theme = “nofancy”

cd /home/pc/website and hugo server and nofancy displays in the browser.

hugo server
0 of 1 draft rendered
0 future content
0 pages created
0 paginator pages created
0 tags created
0 categories created
in 21 ms
Watching for changes in /home/pc/website/{data,content,layouts,static,themes}
Serving pages from memory
Web Server is available at http://localhost:1313

The text in /home/pc/website/content about.md file does not. Why will the browser not show the text from the about.md file? Can you tell a file that will show?

Your about.md file is flagged as a draft:

Either remove that line or run hugo server --buildDrafts

Thanks. Now my text displays both in ‘hugo server’ and ‘hugo server --buildDrafts’. Likely also did it before. I did not know I should press ‘about’ to display the text. Why are there ‘hugo server’ and ‘hugo server --buildDrafts’? What is different?

Themes are html? What could be a forum to ask questions about themes?

The --buildDrafts flag tells the server to render (also called build) content that you have flagged as draft status.