google-code-export / django-page-cms

Automatically exported from code.google.com/p/django-page-cms
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

patch for url aliasing #130

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The attached patch enables the ability to assign aliases to page objects,
which is useful if one wants to migrate existing sites without breaking
links, or to use URLs which do not follow the root-page/page/subpage scheme.

Each alias has three fields:
- the page it is an alias for
- the url which should be the alias (GET parameters like
"index.php?page=foo" are also supported)
- a flag which decides whether this alias should be considered the
"canonical" URL for the page in question. If a page is called through a
non-canonical URL, instead of the page a HTTP 301 request is returned. This
helps avoid duplicate content issues with Google (having the same content
under different URLs would cause Google to rank the page lower)

To make the aliasing system work, three steps are required:
a.) apply patch to current SVN
b.) manage.py syncdb (so the table for the new model gets created)
c.) add 
   (r'^', include('pages.urls'))
   as the last line of your project's urlconf

Original issue reported on code.google.com by chris.vigelius on 20 Jul 2009 at 6:35

Attachments:

GoogleCodeExporter commented 9 years ago
Sweet! I applied the patch. It seems to works well but it break on of the test.

ERROR: test_10_directory_slug

Can you have a look why?

Original comment by batiste....@gmail.com on 21 Jul 2009 at 8:04

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
here's a patch against r611 which adds a unit test for PageAlias, and of course 
also
solves this problem as well as two others (which I detected while writing the 
unit test).

Original comment by chris.vigelius on 21 Jul 2009 at 10:23

Attachments:

GoogleCodeExporter commented 9 years ago
sorry, wrong patch uploaded. here's the correct one ;-)

Original comment by chris.vigelius on 21 Jul 2009 at 10:26

Attachments:

GoogleCodeExporter commented 9 years ago
Patch applied, thanks a lot for the test it's really nice!

Original comment by batiste....@gmail.com on 22 Jul 2009 at 9:03

GoogleCodeExporter commented 9 years ago
closing this bug as it seems to work now.

Original comment by chris.vigelius on 22 Jul 2009 at 4:21