getpelican / pelican

Static site generator that supports Markdown and reST syntax. Powered by Python.
https://getpelican.com
GNU Affero General Public License v3.0
12.58k stars 1.81k forks source link

pagination_patterns settings example in documentation requires additional configuration #1615

Closed blanche closed 6 years ago

blanche commented 9 years ago

If someone wants to use the PAGINATION_PATTERNS example as provided in the documentation (see below), it will only for the main page. When generating tag/categories/authors the fixed "index.html" causes name conflicts.

original documentation:

PAGINATION_PATTERNS = (
    (1, '{base_name}/', '{base_name}/index.html'),
    (2, '{base_name}/page/{number}/', '{base_name}/page/{number}/index.html'),
)

this causes tag/my-tag.html to be renamed to tag/index.html the next tag tag/my-other-tag.html also renamed to index.html will cause an error

CRITICAL: File /path/to/blog/output/tag/index.html is to be overwritten

Additional settings required to fix the issue:

TAG_URL = 'tag/{slug}/'
TAG_SAVE_AS = 'tag/{slug}/index.html'
TAGS_URL = 'tags/'
TAGS_SAVE_AS = 'tags/index.html'

AUTHOR_URL = 'author/{slug}/'
AUTHOR_SAVE_AS = 'author/{slug}/index.html'
AUTHORS_URL = 'authors/'
AUTHORS_SAVE_AS = 'authors/index.html'

CATEGORY_URL = 'category/{slug}/'
CATEGORY_SAVE_AS = 'category/{slug}/index.html'
CATEGORYS_URL = 'categories/'
CATEGORYS_SAVE_AS = 'categories/index.html'

with these setting, the generates pages will look like the following and achieve the desired result:

# main page
index.html
page/2/index.html

# categories/tags/authors
category/misc/index.html
category/misc/page/2/index.html
blanche commented 9 years ago

if someone could confirm this issue, i will try to provide an update for the docs

fractaledmind commented 9 years ago

Confirmed. Just ran into this bug tonight. Exactly as you described.

number5 commented 9 years ago

Have the same issue here. Additional config hadn't fixed it.

1137 is also about this issue

number5 commented 9 years ago

The workaround works with latest master branch 249a91

mseri commented 9 years ago

Same issue for me. The workaround is not working with pelican 3.5.0

muke5hy commented 9 years ago

This solution is not working with pelican 3.5.0

ingwinlu commented 9 years ago

no idea why the sample uses base_name instead of name.

thoughts on changing it?

justinmayer commented 9 years ago

Anyone care to test the workaround with 3.6?

jimmydigital commented 9 years ago

I'm new to Pelican... ran into this problem and found this page.. setting the additional config values fixed it with 3.6.0 installed with pip.

phillipamann commented 8 years ago

While this is helpful, it doesn't exactly fix the issue.

If I am in /categories/ and I want to click a link to tags, the URL will be /categories/tags/... . This happens with Pelican 3.6.3 and Flex theme. I've decided to just drop the Pagination custom patterns for my site.

wallzero commented 8 years ago

I'm in the process of setting up a site and also ran into this issue. You can see here that the page URL's are not including the tag details: http://wallzero.com/tags/two/ The page URL's should be something like "/tags/{tag}/page/{#}/" Feel free to reproduce the issue: https://github.com/Schlesiger/wallzero/tree/cb35ce1a5e8605c1cf805872d5eaa89a04102581 If I am missing something in my config, please let me know.