# Hugo Theme not rendering pages

**URL:** <https://discourse.gohugo.io/t/hugo-theme-not-rendering-pages/15046>\
**Category:** support\
**Created:** [November 2, 2018, 4:18pm UTC](https://discourse.gohugo.io/t/hugo-theme-not-rendering-pages/15046 "2018-11-02T16:18:15Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomburge](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tomburge/32/7252_2.png) [@tomburge](https://discourse.gohugo.io/u/tomburge)\
**Post date:** [November 2, 2018, 4:18pm UTC](https://discourse.gohugo.io/t/hugo-theme-not-rendering-pages/15046/1 "2018-11-02T16:18:15Z")

</div>

First off…I’m really new to hugo and I’m trying to build my own theme. I have the theme mocked up in terms of looks.

 ![theme](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/2X/c/c92a08a198f229e7422700119dcb5276d6b0172b.png)

Everything looks good there.

I created this folder structure since all of the top links are static or external except for posts.

Now when I click about or homelab at the top, I get this:

I’m sure I’m missing something simple due to lack of experience so any help would be appreciated.

Thanks!

---

<div class="post-metadata">

**Author:** ![tomburge](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tomburge/32/7252_2.png) [@tomburge](https://discourse.gohugo.io/u/tomburge)\
**Post date:** [November 2, 2018, 4:23pm UTC](https://discourse.gohugo.io/t/hugo-theme-not-rendering-pages/15046/2 "2018-11-02T16:23:13Z")

</div>

![folders](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/2X/d/d0af116233139d825ddaee925dbb8256ccf19235.png)

---

<div class="post-metadata">

**Author:** ![tomburge](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tomburge/32/7252_2.png) [@tomburge](https://discourse.gohugo.io/u/tomburge)\
**Post date:** [November 2, 2018, 4:27pm UTC](https://discourse.gohugo.io/t/hugo-theme-not-rendering-pages/15046/3 "2018-11-02T16:27:34Z")

</div>

![page2](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/2X/9/9be16e0b33fd6dc25253e90285b5ac3a8112b95c.png)

---

<div class="post-metadata">

**Author:** ![tomburge](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tomburge/32/7252_2.png) [@tomburge](https://discourse.gohugo.io/u/tomburge)\
**Post date:** [November 2, 2018, 5:34pm UTC](https://discourse.gohugo.io/t/hugo-theme-not-rendering-pages/15046/4 "2018-11-02T17:34:55Z")

</div>

Github is having issues but here is the code repo.

> **[tomburge/hugosite](https://github.com/tomburge/hugosite)**
>
> This is my blog site with the VMware Clarity UI. Contribute to tomburge/hugosite development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![benmarte](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/benmarte/32/5948_2.png) [@benmarte](https://discourse.gohugo.io/u/benmarte)\
**Post date:** [November 2, 2018, 7:09pm UTC](https://discourse.gohugo.io/t/hugo-theme-not-rendering-pages/15046/5 "2018-11-02T19:09:54Z")

</div>

remove `draft = true`

Unless you run `hugo server -D` with the draft flag it won’t render draft pages.

---

<div class="post-metadata">

**Author:** ![tomburge](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tomburge/32/7252_2.png) [@tomburge](https://discourse.gohugo.io/u/tomburge)\
**Post date:** [November 2, 2018, 7:14pm UTC](https://discourse.gohugo.io/t/hugo-theme-not-rendering-pages/15046/6 "2018-11-02T19:14:09Z")

</div>

I’m actually running the server with hugo server -D --watch --disableFastRender --verbose

I have set the pages as draft false and did a normal build and still the same behavior. Its weird.

---

<div class="post-metadata">

**Author:** ![tomburge](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tomburge/32/7252_2.png) [@tomburge](https://discourse.gohugo.io/u/tomburge)\
**Post date:** [November 2, 2018, 7:16pm UTC](https://discourse.gohugo.io/t/hugo-theme-not-rendering-pages/15046/7 "2018-11-02T19:16:01Z")

</div>

I’m using this in both my list and single templates as well as the home index.

{{ define “main” }}

{{ .Content }}

{{ end }}

Home index works fine, but neither the single or list does.

---

<div class="post-metadata">

**Author:** ![benmarte](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/benmarte/32/5948_2.png) [@benmarte](https://discourse.gohugo.io/u/benmarte)\
**Post date:** [November 2, 2018, 7:33pm UTC](https://discourse.gohugo.io/t/hugo-theme-not-rendering-pages/15046/8 "2018-11-02T19:33:58Z")

</div>

I don’t use content blocks but I think you need to pass `.` in order to get context into your block, try changing your code to this and see if that helps.

```auto
{{ define “main” . }}

{{ .Content }}

{{ end }}

```

---

<div class="post-metadata">

**Author:** ![tomburge](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tomburge/32/7252_2.png) [@tomburge](https://discourse.gohugo.io/u/tomburge)\
**Post date:** [November 2, 2018, 7:48pm UTC](https://discourse.gohugo.io/t/hugo-theme-not-rendering-pages/15046/9 "2018-11-02T19:48:01Z")

</div>

I got this error:

ERROR 2018/11/02 14:47:14 Failed to add template “\_default/list.html” in path “\_default\list.html”: template: \_default\list.html:1: unexpected \<.\> in define clause  
ERROR 2018/11/02 14:47:14 Failed to add template “\_default/single.html” in path “\_default\single.html”: template: \_default\single.html:1: unexpected \<.\> in define clause

If you don’t use content blocks, is there another way I could accomplish this?

---

<div class="post-metadata">

**Author:** ![benmarte](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/benmarte/32/5948_2.png) [@benmarte](https://discourse.gohugo.io/u/benmarte)\
**Post date:** [November 2, 2018, 7:55pm UTC](https://discourse.gohugo.io/t/hugo-theme-not-rendering-pages/15046/10 "2018-11-02T19:55:46Z")

</div>

Yeah just replace your block with `{{.Content}}` instead of using:

```auto
{{ block "main" . }}{{ end }}

```

In your baseOf template.

After looking at your baseOf template and its docs I think you need to put the `{{.Content}}` inside your main block so it works.

```auto
{{ block "main" }}
{{.Content}}
{{ end }}

```

---

<div class="post-metadata">

**Author:** ![tomburge](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tomburge/32/7252_2.png) [@tomburge](https://discourse.gohugo.io/u/tomburge)\
**Post date:** [November 2, 2018, 8:02pm UTC](https://discourse.gohugo.io/t/hugo-theme-not-rendering-pages/15046/11 "2018-11-02T20:02:04Z")

</div>

I put this in my baseof.html:

```
            {{ block "main" . }}
                {{.Content}}
            {{ end }}

```

Then I put this in my index, single and list layouts:

{{ .Content }}

It coverts my site to plain text and no theme.

---

<div class="post-metadata">

**Author:** ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)\
**Post date:** [November 2, 2018, 8:52pm UTC](https://discourse.gohugo.io/t/hugo-theme-not-rendering-pages/15046/12 "2018-11-02T20:52:45Z")

</div>

@tomburge – I cloned your repo and got things working on my end. The fix was to add a leading `/` to your CSS links to make the paths absolute:

```auto
<link rel="stylesheet" type="text/css" href="/css/clarity-icons.min.css">
<link rel="stylesheet" type="text/css" href="/css/clarity-ui.min.css">

```

Since you are making a theme, though, you should use the `absURL` function for all your assets (CSS, JS, images). To use your CSS as an example:

```auto
{{ $clarityIconsCss := "css/clarity-icons.min.css" }}
<link rel="stylesheet" type="text/css" href="{{ $clarityIconsCss | absURL }}">
{{ $clarityUiCss := "/css/clarity-ui.min.css" }}
<link rel="stylesheet" type="text/css" href="{{ $clarityUiCss | absURL }}">

```

A few other notes… The main block should be used as follows. In your `baseof.html`:

```auto
{{ block "main" . }}{{ end }}

```

Then in your `index.html`, `single.html`, etc., something like:

```auto
{{ define "main" }}

<h1>{{ .Title }}</h1>
{{ .Content }}

{{ end }}

```

Also, your `baseof.html` has invalid HTML. Run it through the [W3 HTML Checker](https://validator.w3.org/nu/#textarea) and fix all the items marked as “Error”.

Just to name a few, you should not wrap your `<html>` with a `<div>` container… that belongs in the `<body>`. You are missing a closing `</html>` tag, etc.

---

<div class="post-metadata">

**Author:** ![tomburge](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tomburge/32/7252_2.png) [@tomburge](https://discourse.gohugo.io/u/tomburge)\
**Post date:** [November 2, 2018, 9:18pm UTC](https://discourse.gohugo.io/t/hugo-theme-not-rendering-pages/15046/13 "2018-11-02T21:18:21Z")

</div>

Awesome! Yeah I must have had some missing tags from cutting and pasting a lot.

I really appreciate it. Thanks for the help!
