ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Forcing Me To Add Template Group

April 11, 2012 12:30pm

Subscribe [5]
  • #1 / Apr 11, 2012 12:30pm

    lealea

    202 posts

    I’m on EE 2.4 20120123 working locally.

    I have a template group called “site.” In the index template, I have ONE channel entries loop. That looks like this:

    {exp:channel:entries channel="pages" limit="1"}
        <article>
        <h2>{title}</h2>
    <p>     {page_body}<br />
        <br />
        </article><br />
    {/exp:channel:entries}


    Pretty basic, right? Mostly because I’ve stripped everything down to confirm what the heck is going on.

    At any rate, since this is the main site’s index template, it means I don’t NEED to add the template group to render an entry. So, my assumption is if I went:

    http://domain.com/title-of-entry

    It should render the contents of that entry. However, this is not the case. Instead, I get a 404. The only way I can have the entry show up is if I go:

    http://domain.com/site/title-of-entry

    My understanding is if I use the index template, this should NOT be unnecessary?

    I also did some testing: this ONLY happens if I have Strict URLs and/or 404 template. My expectations ONLY work when I have Strict URLs turned off AND no 404 template chosen. I’d rather have the Strict URLs and 404 templates turned on for obvious reasons.

    Help?

  • #2 / Apr 11, 2012 1:00pm

    Derek Hogue

    316 posts

    This is definitely a function of the Strict 404 setting, and it’s functioning as expected. You’re using a segment, so EE is trying to map it to a template group, not finding one, and not finding a Pages module entry, so it’s a 404 for you. The “Make the index template in this group your site’s home page?” setting is just for the home page, i.e., your site URL with no segments.

    To get urls like http://domain.com/title-of-entry without creating a new template group for each, I’d just use the Pages module.

  • #3 / Apr 11, 2012 1:05pm

    lealea

    202 posts

    Thought of that, but it isn’t user-friendly to the client who needs to make multiple pages to input a page uri each time.

    Additionally, they’re entries under a category, so ideally, it’d be domain.com/category_name/url_title/ and have the entries render based on segments. Which works when I don’t have strict urls turned on or a 404 page specified.

    I guess I’ll have to keep strict urls turned off and just be more creative with how I deal with 404s? 😕

  • #4 / Apr 11, 2012 1:07pm

    Sean C. Smith

    3818 posts

    Lea,
    There’s an add-on on devot:ee that copies the url_title to the pages_uri field. can’t remember the name offhand, but that might help.

    Sean

  • #5 / Apr 11, 2012 1:09pm

    Derek Hogue

    316 posts

    I think the whole point of Strict URLs is to prevent duplicate content, so as long as you’re vigilant with {if no_results}{redirect="404"}{/if}, you should be OK.

    Are you positive that disabling Strict URLs but keeping a custom 404 template still causes this problem? If so, I think that’s a bug.

  • #6 / Apr 11, 2012 1:15pm

    lealea

    202 posts

    Derek: Positive. Just tested it now and it gives me 404 when I just specify the 404 template but NOT strict URLs. I turn that off, voila, works again. And yep, added that {if no_results} loop too, but if I redirect=404, it gives me a generic 404 page, not my created 404 template. Which may just be a server related thing. Otherwise, I may just have to redirect to site/404 and force an error header to that template.

    Sean: http://devot-ee.com/add-ons/pages-autosave-uri  That seems to be it! However, I would like to append the category name to the url. If that’s not inputted in the pages uri field, that means it won’t render as expected, right? I like my pages organized. 😛

  • #7 / Apr 11, 2012 1:29pm

    Derek Hogue

    316 posts

  • #8 / Apr 11, 2012 1:35pm

    lealea

    202 posts

    Thanks Derek… and for those looking for further 404 resources, found this:
    http://joviawebstudio.com/blog/guide_to_404_pages_with_expressionengine/

    I’ll be implementing all that makes sense from there.

  • #9 / Apr 12, 2012 12:06pm

    Shane Eckert

    7174 posts

    Hi All,

    I love seeing the community so active and working together so well. It’s awesome.

    Nice work and thank you for filing the bug.

    I also really enjoyed reading through the link lealea.

    Have a great week guys!

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases