Mercurial > piecrust2
comparison 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 |
comparison
equal
deleted
inserted
replaced
722:f0a3af3fbea2 | 723:606f6d57b5df |
---|---|
334 default_content_model_base = collections.OrderedDict({ | 334 default_content_model_base = collections.OrderedDict({ |
335 'site': collections.OrderedDict({ | 335 'site': collections.OrderedDict({ |
336 'posts_fs': DEFAULT_POSTS_FS, | 336 'posts_fs': DEFAULT_POSTS_FS, |
337 'default_page_layout': 'default', | 337 'default_page_layout': 'default', |
338 'default_post_layout': 'post', | 338 'default_post_layout': 'post', |
339 'post_url': '/%year%/%month%/%day%/%slug%', | 339 'post_url': '/%int4:year%/%int2:month%/%int2:day%/%slug%', |
340 'year_url': '/%year%', | 340 'year_url': '/archives/%int4:year%', |
341 'tag_url': '/tag/%path:tag%', | 341 'tag_url': '/tag/%path:tag%', |
342 'category_url': '/%category%', | 342 'category_url': '/%category%', |
343 'posts_per_page': 5 | 343 'posts_per_page': 5 |
344 }) | 344 }) |
345 }) | 345 }) |
457 }), | 457 }), |
458 'routes': [ | 458 'routes': [ |
459 { | 459 { |
460 'url': post_url, | 460 'url': post_url, |
461 'source': blog_name, | 461 'source': blog_name, |
462 'func': 'pcposturl(year,month,day,slug)' | 462 'func': 'pcposturl(int:year,int:month,int:day,slug)' |
463 }, | 463 }, |
464 { | 464 { |
465 'url': year_url, | 465 'url': year_url, |
466 'generator': ('%s_archives' % blog_name), | 466 'generator': ('%s_archives' % blog_name), |
467 'func': 'pcyearurl(year)' | 467 'func': 'pcyearurl(archive_year)' |
468 } | 468 } |
469 ] | 469 ] |
470 }) | 470 }) |
471 }) | 471 }) |
472 | 472 |