• I find myself in a strange situation. I’m converting a static xhtml/css site into a custom theme and have run into trouble using the parent/child relationship, in an effort to keep my pages (not posts) organized in the back end.

    My permalink settings are set to custom /%postname%.html as it stands.

    When I navigate around the parent pages, everything works fine. I can navigate from page to page and the url is refreshed according to the page I want to view.

    e.g.
    /about
    /preview
    /order

    However, as soon as I click on a child page

    e.g.
    /about/book
    /about/career
    /about/author

    the parent slug of that child remains in the url even after I navigate away from the child page, which breaks my navigation and causes 404s.

    So say I want to navigate from /about/book back to the parent page. When I return my url looks like this:

    /about/about

    The result is a 404 page and a major headache. Help! Does anyone know why this is happening and what I would need to do to fix it?

    One possible solution is to scrap the parent/child relationship altogether, but I’d rather keep it for organizational purposes.

    Thanks in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • My permalink settings are set to custom /%postname%.html as it stands.

    That is a really bad choice of permalink for a page-heavy site.
    The technical explanation

    I’d suggest starting with one of the preset custom permalink structures, using a simple parent-child relationship for your Pages and build from there.

    Thread Starter hellodrifter

    (@hellodrifter)

    Thanks for your fast response esmi!

    I’ll go do some further reading on permalink structures, play around and get back to you with my findings. After reading the codex for a few minutes I’ve already come across this strong warning:

    Starting Permalinks with %postname% is strongly not recommended for performance reasons.

    The only caveat I have is that I need human friendly permalinks like in my previous example, so it is easy to direct clients to the website over the phone. So I hope to create a permalink structure without any numbers if that is feasible.

    Thread Starter hellodrifter

    (@hellodrifter)

    My website is small, clocking in at only 32 pages. I can’t see that number surpassing 50 anytime in the foreseeable future. As such, I may do away with parent child relationships altogether to fix this problem.

    Non-numeric, client friendly urls are of the utmost importance for this particular website. That said, I understand (thanks to esmi) the danger my permalink structure poses to site performance. Otto has done a great job of explaining the danger in layman’s terms.

    http://ottopress.com/2010/category-in-permalinks-considered-harmful/

    Seems using only %postname% for my permalinks will put undue strain onto the database (due to verbose page rules), and could cause serious performance issues if the website expands beyond 50, and into the hundreds of pages range.

    My question then, is there any work around to avoid triggering verbose page rules, while also allowing clients to navigate to a particular page via a non-numeric URL? Perhaps a plugin that would allow me to use a database friendly permalink structure (e.g. /yyyy/mm/dd/postname/), that redirects clients who enter a human frienly URL (e.g. /postname/)?

    Any thoughts?

    I think that %post_id%/%postname% is a reasonable compromise. Bear in mind that this structure will only affect your Posts – not Pages. The latter will always use %postname%.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Once navigated to a child page, parent slug stays "stuck" in the site url.’ is closed to new replies.