Page URLS

30 views
Skip to first unread message

Michael Gall

unread,
Nov 19, 2007, 8:30:52 PM11/19/07
to silverst...@googlegroups.com
Hi guys,

Just wondering if there are any technical reason we can't support forward slashes in page urls. I want this so that we can build a kind of a tree structure with the urls.

Michael

--
--

http://wakeless.net

Nathan Cox

unread,
Nov 19, 2007, 8:58:44 PM11/19/07
to silverst...@googlegroups.com
Do you mean actual hierarchy URLs like /{page}/{subpage} or just putting '/' in the URLSegment to make it look like you have hierarchy URLs?

My understanding is that neither is the kind of thing you can just do and expect it to not break everywhere.  Believe me, I've tried :)

Sam Minnee

unread,
Nov 19, 2007, 8:59:25 PM11/19/07
to SilverStripe Development
There's no major technical reason, however, there are probably a lot
of URLSegment validation regular expressions that exclude them
throughout the system that would need to be checked:

* HTMLEditorField link checking
* CMSMain entry
* Director / ModelAsController URL parsing

I think that if you patched the system to handle \s in URLSegments
that we would commit it to trunk - there's no reason not to allow this
apart from us not considering it! :-)

Sam Minnee

unread,
Nov 19, 2007, 10:05:45 PM11/19/07
to SilverStripe Development
To be clear - we're talking about **front** slashes that aren't
currently used by the Director's URL parser.

Adding backslashes to URLSegments would be a lesson in pain.

Sigurd Magnusson

unread,
Nov 19, 2007, 10:13:50 PM11/19/07
to silverst...@googlegroups.com

Sam wrote,

I think that if you patched the system to handle \s in URLSegments
that we would commit it to trunk - there's no reason not to allow this
apart from us not considering it! :-)

On Nov 20, 2:30 pm, "Michael Gall" <mich...@wakeless.net> wrote:
  
Hi guys,

Just wondering if there are any technical reason we can't support forward
slashes in page urls. I want this so that we can build a kind of a tree
structure with the urls.

Michael
    
--~--~----

FYI

Michael mentioned forward slashes, Sam mentioned "\"
These are two are different if we go by the gospel, http://en.wikipedia.org/wiki/Forward_slash

I guess www.silverstripe.com/blog\some-article/ to allow page names like "blog\some-article" could be a good hack, but its a bit confusing. May be the best interim solution.

Sig

Nathan Cox

unread,
Nov 19, 2007, 10:18:07 PM11/19/07
to silverst...@googlegroups.com
That's what was confusing me...

Sam Minnee

unread,
Nov 19, 2007, 10:56:51 PM11/19/07
to SilverStripe Development
Arg - my mistake!

Okay - so, to answer the original question. The current system is set
up to interpret the slash as separating the URLSegment and the action
(URLSegment)/(Action).

So if you visit http://www.silverstripe.com/blog/rss - is that the
"blog/rss" page, or the rss action within the blog? You could resolve
it, either by looking to see if an rss action is available on the
blog, or to see if a "blog/rss" page exists, but you leave open the
risk of accidentally breaking things by creating a page that clobbers
an action, or vice versa. Hackable, but not elegant.

After you've dealt with that, you're going to need to edit a lot of
different bits of code that is built on the assumption that internal
links are of the form '^[A-Za-z0-9_\-]+/$'.
* Edit an existing link in the CMS
* Recognise internal links for broken link detection in
HTMLEditorField
* Update internal links when page URLSegments are edited
* Generation of $Link?
* URL Uniqueness checking?
* Other stuff that I haven't considered?

Once you've got that basic level of functionality established, you to
update the default URL generation:
* It will need to take the parent URL segment into account.
* If the pages are reorganised the URL segment will need to be
updated.
* If the URLSegment of a container pages is changed (including if it
was reorganised) then all of the descendant pages will have to have
their URLSegments changed.
* Since there will now be actions that can trigger the editing of a
bunch of URLSegments, you will need to figure out an intuitive UI for
letting people confirm that they do want the URLs to be changed as a
result of their reorganisation.

So... not for the faint of heart. I would expect weeks of development
and a lot of hairy bugs.

Is it really that important to you?

Sigurd Magnusson

unread,
Nov 19, 2007, 11:03:00 PM11/19/07
to silverst...@googlegroups.com
Can you partly simplify the situation by enforcing some rules, like

a trailing slash always means a page,

and the absence of a slash means check for a method first, but fail back
to a page if no method exists (and when you fail back, do a http
permanent redirect to the page with a slash, to encourage the use of
trailing slashes on pages).

Michael Gall

unread,
Nov 19, 2007, 11:04:49 PM11/19/07
to silverst...@googlegroups.com
I like hairy bugs!
--
--

http://wakeless.net

Sam Minnee

unread,
Nov 19, 2007, 11:27:48 PM11/19/07
to SilverStripe Development
Well, you guys have certainly made some impressive improvements to
SilverStripe - if you're looking for some Real Men's Coding(tm), this
would be it! :-)

On Nov 20, 5:04 pm, "Michael Gall" <mich...@wakeless.net> wrote:
> I like hairy bugs!

Sigurd Magnusson

unread,
Nov 21, 2007, 4:56:39 AM11/21/07
to SilverStripe Development
Yeah, its certainly an oft-requested item in the forum, so you'd
certainly get a round of applause from us if you pulled it off!
Reply all
Reply to author
Forward
0 new messages