# Disable specific content types

**URL:** <https://discourse.gohugo.io/t/disable-specific-content-types/10999>\
**Category:** support\
**Created:** [March 11, 2018, 9:51pm UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999 "2018-03-11T21:51:28Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon70557456](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@anon70557456](https://discourse.gohugo.io/u/anon70557456)\
**Post date:** [March 11, 2018, 9:51pm UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999/1 "2018-03-11T21:51:28Z")

</div>

I am currently trying to create a small website with Hugo. It should have an index page and a blog section.  
For generating my index page I am using some content types so I don’t have to put it’s data into layout files. But I do not want Hugo to generate single pages for them. On the other hand, for my content type “post” Hugo should generate single pages.

It is possible to disable page creation for specific content types, so you can use them as a data Backend without worrying about empty and unnecessary single pages?

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [March 11, 2018, 9:56pm UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999/2 "2018-03-11T21:56:41Z")

</div>

I think what you want is

> **[Page Bundles](https://gohugo.io/content-management/page-bundles/#headless-bundle)**
>
> Content organization using Page Bundles

---

<div class="post-metadata">

**Author:** ![anon70557456](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@anon70557456](https://discourse.gohugo.io/u/anon70557456)\
**Post date:** [March 13, 2018, 10:41pm UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999/3 "2018-03-13T22:41:32Z")

</div>

Yes, this seems to be a new feature.  
Nevertheless, I am not able to get it running. I have created a directory `content/landing` in which I placed the following files: `about.md`, `other.md` and `index.md`.

This is my `index.md` in `content/landing` to make it a page bundle:

```auto
---
headless: true
---

```

According to [Headless Bundle](https://gohugo.io/content-management/page-bundles/#headless-bundle) and [.GetPage](https://gohugo.io/functions/getpage/) I should be able to get the content of `about.md` with

```auto
{{ with .Site.GetPage "page" "landing" "about.md" }}
<div class="ui left aligned container">
{{ .Content }}
</div>
{{ end }}

```

but it doesn’t work. I think I am missing something simple.

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [March 13, 2018, 10:52pm UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999/4 "2018-03-13T22:52:09Z")

</div>

Check the example in the Headless Bundle doc you linked. ~~You have the syntax did `.GetPage` wrong… it takes only 2 arguments. And~~ then you need the `.Resources` call.

---

<div class="post-metadata">

**Author:** ![anon70557456](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@anon70557456](https://discourse.gohugo.io/u/anon70557456)\
**Post date:** [March 13, 2018, 10:57pm UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999/5 "2018-03-13T22:57:44Z")

</div>

I thought that I am able to get a specific page (not an index) with

```auto
{{ with .Site.GetPage "page" "blog" "my-post.md" }}{{ .Title }}{{ end }}

```

as mentioned in the documentation of .GetPage.

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [March 13, 2018, 11:04pm UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999/6 "2018-03-13T23:04:45Z")

</div>

Of course, sorry about that. The syntax of`.GetPage` is correct. But it still won’t work for your case, as the page is **headless**.

Think of _headless_ pages as being “hidden” in general. The only way to retrieve them is by first getting the page “object” using `.GetPage`, and then accessing the _page resources_ in that from `.Resources`.

---

<div class="post-metadata">

**Author:** ![anon70557456](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@anon70557456](https://discourse.gohugo.io/u/anon70557456)\
**Post date:** [March 13, 2018, 11:13pm UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999/7 "2018-03-13T23:13:05Z")

</div>

Oh okay. What do you mean with a “page object”? Do I have to call `.GetPage` with `"page" "landing"`?  
How can I get only `about.md` and not `other.md`.

As far as I understand, calling `.GetPage` with `"page" "landing"` will return a set of pages.

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [March 13, 2018, 11:26pm UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999/8 "2018-03-13T23:26:44Z")

</div>

> [@anon70557456](#):
>
> What do you mean with a “page object”?

Hugo sees that whole landing directory as a page, with page resources. The whole thing is a headless leaf bundle.

> [@](#):
>
> Do I have to call .GetPage with “page” “landing”?

Yes.

> [@](#):
>
> How can I get only about.md and not other.md.

Use `.Resources.Match` with a glob that matches just that page, like `"about*"` (_understand that documented example in entirety_).

`.Match` returns a _slice_ (or a list), so you might want to use `.GetMatch` (search in docs) instead.

> [@](#):
>
> As far as I understand, calling .GetPage with “page” “landing” will return a set of pages.

Nope, from my experience, it returns just one page, as the name says.

---

<div class="post-metadata">

**Author:** ![anon70557456](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@anon70557456](https://discourse.gohugo.io/u/anon70557456)\
**Post date:** [March 14, 2018, 10:42am UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999/9 "2018-03-14T10:42:00Z")

</div>

Thank you, now I got it. I have to say, that the documentation is a bit confusing.

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [March 14, 2018, 11:03am UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999/10 "2018-03-14T11:03:31Z")

</div>

I am curious… which part in the documentation was confusing, that got clarified in this thread?

---

<div class="post-metadata">

**Author:** ![anon70557456](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@anon70557456](https://discourse.gohugo.io/u/anon70557456)\
**Post date:** [March 14, 2018, 5:00pm UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999/11 "2018-03-14T17:00:23Z")

</div>

I didn’t know that I can’t get a page in a headless bundle directly with `.Get.Page “my/headless/page.md”.  
For me, it is still unclear how I can access font matter data from the headless bundle index element:

```auto
{{ $textcolumns := .Site.GetPage "page" "landing/textcolumns" }}
{{ $textcolumns.Params.columnSize }}

```

I think an example which mentions all these elements may be an improvement.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [March 14, 2018, 5:21pm UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999/12 "2018-03-14T17:21:24Z")

</div>

> [@anon70557456](#):
>
> I didn’t know that I can’t get a page in a headless bundle directly with `.Get.Page “my/headless/page.md”.

You can, but you need to understand what a bundle is. A headless bundle’s content file **must start with “index”** , “index.md” being the normal case. And, you can address that bundle with its path + filename, but for those files you can also just point to the owning folder:

So,

```bash
.Site.GetPage "page" “blog/my-bundle/index.md"

```

Or simply:

```bash
.Site.GetPage "page" “blog/my-bundle"

```

The last variant is useful if you have a multilingual setup (“give me the current language version”).

The above will work if you have a content file in `content/blog/my-bundle/index.md`.

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [March 14, 2018, 6:33pm UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999/13 "2018-03-14T18:33:05Z")

</div>

> [@anon70557456](#):
>
> how I can access font matter data from the headless bundle index element

I hadn’t tried that earlier. But I just tried it and [it works](https://ox-hugo.scripter.co/test/posts/page-using-headless-page-bundle/#headless-bundle-params-debug) (that link lists the values of all Params from the index page of the headless bundle). [Here’s the layout file](https://github.com/kaushalmodi/ox-hugo/blob/master/test/site/layouts/_default/headless-bundle-single.html) for that page.

It’s difficult to tell why it’s not working for you unless you share your site source.

---

<div class="post-metadata">

**Author:** ![anon70557456](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@anon70557456](https://discourse.gohugo.io/u/anon70557456)\
**Post date:** [March 14, 2018, 9:11pm UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999/14 "2018-03-14T21:11:10Z")

</div>

> [@kaushalmodi](#):
>
> It’s difficult to tell why it’s not working for you unless you share your site source.

Layout:

```auto
{{ define "main" }}
<!-- SOME CODE -->
{{ $iconcolumns := .Site.GetPage "page" "landing/iconcolumns" }}
{{ range $iconcolumns.Resources }}
<div class="{{ $iconcolumns.Params.columnSize }} wide column">
<i class="huge {{ .Params.icon }} icon"></i>
<h1 class="ui header">{{ .Title }}</h1>
{{ .Content }}
<a class="ui right {{ .Params.buttonStyle }} labeled icon button" href="{{ .Params.buttonHref }}">
<i class="right arrow icon"></i>
{{ .Params.buttonCaption }}
</a>
</div>
{{ end }}
<!-- SOME CODE -->
{{ end }}

```

landing/content/iconcolumns/index.md:

```auto
---
headless: true
columnSize: "four"
---

```

Anything else works…

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [March 14, 2018, 9:13pm UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999/15 "2018-03-14T21:13:32Z")

</div>

> [@anon70557456](#):
>
> “page” “landing/iconcolumns” }}

> [@anon70557456](#):
>
> content/iconcolumns/index.md

You have that `"landing/"` part extra in the first part?

---

<div class="post-metadata">

**Author:** ![anon70557456](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@anon70557456](https://discourse.gohugo.io/u/anon70557456)\
**Post date:** [March 14, 2018, 9:14pm UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999/16 "2018-03-14T21:14:44Z")

</div>

> [@bep](#):
>
> You can, but you need to understand what a bundle is.

That’s correct. I don’t say that it is not possible to undestand. It is easy, if you got the point, that you have to access “pages” of a headless bundle using its index, because these pages are “objects” of the headless bundle.

Maybe it is hard for me because I am new to Hugo and Go.

---

<div class="post-metadata">

**Author:** ![anon70557456](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@anon70557456](https://discourse.gohugo.io/u/anon70557456)\
**Post date:** [March 14, 2018, 9:16pm UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999/17 "2018-03-14T21:16:00Z")

</div>

> [@kaushalmodi](#):
>
> You have that “landing/” part extra in the first part?

Oh sorry, I missed it, my fault. But as I said, this range loop works and it creates columns for all pages in `content/landing/iconcolumns`.

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [March 14, 2018, 9:21pm UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999/18 "2018-03-14T21:21:22Z")

</div>

> [@anon70557456](#):
>
> \<div class=“{{ $iconcolumns.Params.columnSize }} wide column”\>

Ah, OK, this was was a silly one… all front matter params need to be in lower case… so even if you set `columnSize: "four"`, internally that value gets assigned to `columnsize`.

**Just stick with all-lowercase front-matter param keys.**

* * *

From:

> **[Page methods](https://gohugo.io/methods/page/)**
>
> Use these methods with a Page object.

> Page-level .Params are only accessible in lowercase.

---

<div class="post-metadata">

**Author:** ![anon70557456](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@anon70557456](https://discourse.gohugo.io/u/anon70557456)\
**Post date:** [March 14, 2018, 9:25pm UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999/19 "2018-03-14T21:25:29Z")

</div>

> [@kaushalmodi](#):
>
> Ah, OK, this was was a silly one… all front matter params need to be in lower case… so even if you set columnSize: “four”, internally that value gets assigned to columnsize.

You are right… 😂  
Well, that was too easy. Thank you for helping!

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [March 14, 2018, 9:32pm UTC](https://discourse.gohugo.io/t/disable-specific-content-types/10999/20 "2018-03-14T21:32:33Z")

</div>

> [@kaushalmodi](#):
>
> all front matter params need to be in lower case

That is not entirely true, but it is out of scope from this discussion.
