3

I apologize for opening up a whole new question for this topic since it's been discussed a few times now, however I don't have enough rep yet to comment on the existing questions.

Regarding the answer to this question:

Channel index page linked in a structure

So what this answer is saying is that instead of having a whole separate channel for say, a blog, I should have it set up so that "Blog" is an entry type in my larger structure that also contains the various static pages for my site? if I'm understanding that correctly, doesn't the user lose out on some of the basic feature that a separate channel offers, such as not having to choose where in the structure hierarchy a new blog post should be?

1 Answer 1

2

I don't think that carlcs was suggesting that you incorporate individual blog posts into the 'pages' structure. He was only suggesting that you place those pages into the structure that you would want in your main navigation (using different entryTypes defined for each page layout); like your blog index page for example. In your case, what you would likely want to do (assuming you are following this strategy at all), is to create an entry for 'blog' in your structure, with a unique entryType called 'blogIndex' for example, and a matching template called '_blog.html' or '_blog.twig' which will be your blog landing/index page.

You would then create a channel for your individual blog entries, also called 'blog'.

In this way the urls will sync up nicely, such that the uri '/blog' will display your structure entry (which is designed to render, for example, a summary of the first 20 blog entries from your 'blog' channel); and the uri '/blog/my-blog-entry-title' will display your blog entry detail page from your 'blog' channel (assuming the blog entries are long enough that you even need a detail page).

Check out this answer for a more specific example with code examples.

7
  • You definitely know how to explain things!
    – carlcs
    Apr 8, 2015 at 17:13
  • Thanks Dogulas, I'll give that a shot. I remember reading the other post you referenced, but for some reason it hasn't been coming up in my search!
    – rfoote
    Apr 9, 2015 at 19:23
  • Ok, I'm missing a critical piece here. This is what I have set up so far: A Structure called 'pages' that has two entry types, 'page' and 'blogIndex'. Most of the pages on my site use the 'page' type, and I set up one entry in the structure using the 'blogIndex' type which would represent the blog index and nested it down in the hierarchy of my Structure. I have a template at /templates/pages/_blog.twig that's supposed to represent the blog landing/index, but when visiting the URL for the blog index, it displays the default _entry.html template instead of the template I set up for the index.
    – rfoote
    Apr 9, 2015 at 19:40
  • I think I got it working, using the following technique: buildwithcraft.com/help/entry-type-templates Is this what you hand in mind Douglas? Was this the last piece I was missing?
    – rfoote
    Apr 9, 2015 at 20:37
  • Yes. Exactly. Sorry, I should have included that link as well. Glad you got it working. Apr 10, 2015 at 2:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.