Mercurial > piecrust2
diff piecrust/appconfig.py @ 723:606f6d57b5df
routing: Cleanup URL routing and improve page matching.
* Add new types of route parameters for integers (int4, int2, int).
* Remove hard-coded hacks around converting year/month/day values.
* Make the blog post routes use the new typed parameters.
* Fix problems with matching routes with integer parameters when they can
get confused with a sub-page number.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 29 May 2016 20:19:28 -0700 |
parents | ab5c6a8ae90a |
children | 8c3c2b949b82 |
line wrap: on
line diff
--- a/piecrust/appconfig.py Sun May 29 20:15:56 2016 -0700 +++ b/piecrust/appconfig.py Sun May 29 20:19:28 2016 -0700 @@ -336,8 +336,8 @@ 'posts_fs': DEFAULT_POSTS_FS, 'default_page_layout': 'default', 'default_post_layout': 'post', - 'post_url': '/%year%/%month%/%day%/%slug%', - 'year_url': '/%year%', + 'post_url': '/%int4:year%/%int2:month%/%int2:day%/%slug%', + 'year_url': '/archives/%int4:year%', 'tag_url': '/tag/%path:tag%', 'category_url': '/%category%', 'posts_per_page': 5 @@ -459,12 +459,12 @@ { 'url': post_url, 'source': blog_name, - 'func': 'pcposturl(year,month,day,slug)' + 'func': 'pcposturl(int:year,int:month,int:day,slug)' }, { 'url': year_url, 'generator': ('%s_archives' % blog_name), - 'func': 'pcyearurl(year)' + 'func': 'pcyearurl(archive_year)' } ] })