|
Table of Contents
Spec: SEO friendly URLs + subpages [4.7]
IntroductionCurrently, pluck pages are stored as "kop1.php", "kop2.php", "kop3.php", etc. Because of this, implementing SEO friendly URLs is almost imposible. Pluck will have to save pages with their title as filename (for example home.php, contact.php or about-us.php), and create a cache-file that defines the order of the pages. Then, implementing SEO friendly URLs shouldn't be difficult. The new blog module in pluck 4.6 will also contain this approach, so we can use large parts code when this module is finished (see blueprint new-blog-module). Sander Thijsen: this is not the case, because we also need to implement sub pages support. While we're busy reorganizing the page system, we can also implement sub pages.
The blueprint of this spec is located at Launchpad. There, you can also track the progress of implementation.
SpecificationThis is a first rough concept of what could become the new page ordering system. In short, the proposal can be summarized as follows:
The page index file (XML)As noted before, this file will contain the order of the pages, and also will define the hierarchy of those pages. The file will also contain the filename of the page and the title. The latter should be included, because then we don't need to include all pages when generating a menu, like we are doing now. The only file we then need to access to generate a menu, is the XML-file. Why XML? Because XML is easy to read, easy to understand and easily convertable to and from a PHP-array. An XML-file could look this: <?xml version="1.0" encoding="UTF-8"?> <pages> <page> <name>Homepage</name> <filename>homepage.php</filename> <page> <name>Subpage 1</name> <filename>subpage-1.php</filename> </page> <page> <name>Subpage 2</name> <filename>subpage-2.php</filename> <page> <name>Subpage 2-1</name> <filename>subpage-2-1.php</filename> </page> </page> </page> <page> <name>Another page</name> <filename>another-page.php</filename> </page> <page> <name>Yet Another page</name> <filename>yet-another-page.php</filename> </page> </pages> When converting this example to a PHP-array, this is the result (the function used can be found on Bin-Co): Array ( [pages] => Array ( [page] => Array ( [0] => Array ( [name] => Homepage [filename] => homepage.php [page] => Array ( [0] => Array ( [name] => Subpage 1 [filename] => subpage-1.php ) [1] => Array ( [name] => Subpage 2 [filename] => subpage-2.php [page] => Array ( [name] => Subpage 2-1 [filename] => subpage-2-1.php ) ) ) ) [1] => Array ( [name] => Another page [filename] => another-page.php ) [2] => Array ( [name] => Yet Another page [filename] => yet-another-page.php ) ) ) ) This is a quite complex, multi-dimensional array. I however think it's the only way to properly create a page-ordering system with an unlimited amount of dimensions for subpages. With this system, every page can contain a subpage, or even a subsubpage or subsubsubsubpage. FunctionsI propose the following functions to be created or adjusted:
Maybe it's also an idea to add the following two functions too. They could use the xml2array() to read out the XML-file.
ConclusionThis only a first rough concept, and there may still be things that need to be worked out. Feel free to add suggestions to this page, or mail them to the development mailing list. If needed, I will make a second (updated) version of the draft, or create an entirely new draft. |