Posts: 3
Threads: 1
Joined: Apr 2014
Hi all
I am trying to work out the best way to use fancy URLs (using default permalink structure) and sub-level navigation. As far as I can see all pages live at the top level ie. ?id=page1, ?id=page2 even if page2 is set as a child of page1 in the navigation structure. Can this be overridden?
I am currently using the child menu plugin in the sidebar and have pretty url links to domain/page1/page2 which I think makes sense, unfortunately ?id=page1/page2 doesn't work!
Any suggestions would be much appreciated!
Cheers
Chris
Posts: 52
Threads: 2
Joined: May 2013
GS goes about subpages in a specific fasion. You can have pages nested multiple levels deep, but the URLs generated in menus will never show more than two sublevels. Even then if you go ahead and completely omit everything from the domain to the last slash, the page will still load : )
That's because GS takes the last part (after the slash) of the URL as a page ID. However if you want to have "politically correct" URLs, then do this:
- install the I18N plugin.
- Change the %parent% to %parents% in your permalink structure.
- At the very least replace the get_navigation() function in your theme file with i18n's counterpart get_i18n_navigation() function.
There, multiple levels deep URLs. Tho manually you can still omit all the sublevels up to the last one : )
Posts: 3
Threads: 1
Joined: Apr 2014
Hi
Thanks for the help. I am already using the I18N plugin(s) and get_i18n_navigation(). I think the menu links created are okay ie. www.mydomain.com/parent/child.
However when you click the link I just get Oops! Page not found! I am also using the Fancy URLs in IIS plugin at
http://get-simple.info/extend/plugin/fan...n-iis/496/.
As far as I can see www.mydomain.com/parent/child is being converted back to www.mydomain.com/?=parent/child which seems to make sense.
Only GetSimple doesn't know what to do with it (permalink is %slug%/ - as suggested by IIS plugin instructions). www.mydomain.com/?=child loads fine.
I initially thought that the custom url field in the page options was the thing to adjust, but if I put in 'parent/child' it strips out the '/' so guess not.
Really scratching my head, and am sure it is something obvious to change!
Chris
Posts: 3,491
Threads: 106
Joined: Mar 2010
Not sure about this, but it might be the web.config file included in the Fancy URLs in IIS zip is only compatible with the %slug%/ structure.
Posts: 3
Threads: 1
Joined: Apr 2014
Well I looked further afield and revised my IIS rewrite rule to the following: /?([A-Za-z0-9-]+)/?$ which works a treat, so cheers Carlos for pushing me back in the right direction. Happy days!
Cheers
Chris
Posts: 30
Threads: 4
Joined: Feb 2016
2016-04-15, 00:36:56
(This post was last modified: 2016-05-07, 04:41:24 by jlyon1515.)
Finding this note about %parents% (with an S) instead of %parent% is exactly what I was looking for! But I just noticed an odd error. If one goes back to the settings page after changing the Custom Permalink Structure field, that field is ALWAYS empty, or more specifically, that field always has the placeholder text in it, no matter what you just saved that field as. SO it always has %parent%/%slug%/ greyed out in it, even after I just applied %parents%/%slug% (added that S on parent and removed the trailing slash).
Shouldn't that field always show what the current setting is?
Posts: 30
Threads: 4
Joined: Feb 2016
2016-05-07, 05:00:00
(This post was last modified: 2016-05-07, 05:30:11 by jlyon1515.
Edit Reason: Added note about get_header as well.
)
Besides the error that I mentioned above, it appears that I've found another error. When my Custom Permalink Structure field is set to %parents%/%slug%, the get_page_url function literally places %parents% in my URL. So it returns something like "http://www/mysite.com/%parents%/pageslug".
The function get_header must use the get_page_url too, because it returns the <link rel="canonical" href=... line as having the %parents% as well.
Should I submit this as an error to GitHub? I've never done that before, but if it means that a fix would happen, it'd be worth it!
Posts: 3,491
Threads: 106
Joined: Mar 2010
You have to change get_header
by get_i18n_header
in your template.
Posts: 30
Threads: 4
Joined: Feb 2016
2016-07-23, 06:39:52
(This post was last modified: 2016-12-01, 01:33:44 by jlyon1515.)
(2016-05-07, 06:34:39)Carlos Wrote: You have to change get_header
by get_i18n_header
in your template.
Thanks, Carlos!
I also had a statement like this:
$u = urlencode(get_page_url(true));
But that was returning a string with %parents% in it as well, not the one or two level of parents. For future reference, and for anyone else who might have the problem, I changed that line to the following, and it made the correct multi-level URL:
$u = urlencode(return_i18n_lang_url());
I was looking for a get_i18n_page_url function, and couldn't find it, but return_i18n_lang_url() does the trick.