-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when attempting to manually overwrite a category page #1223
Comments
For what it's worth, it seems that enabling the pagination settings as described in the documentation also generates this kind of error.
|
Any thoughts on this, @Rogdham? |
Some more information: You can find my site directory on github: https://github.com/jminardi/jminardi.github.io I have a category called "projects": https://github.com/jminardi/jminardi.github.io/tree/master/.source/content/projects And then I attempt to also write a page called projects: https://github.com/jminardi/jminardi.github.io/blob/master/.source/content/pages/projects.md I added some extra metadata |
@jminardi wrote:
Looking at your website, it seems that you want to override every category listening. @justinmayer: good question though: what if someone would like to override only one category?
So if we want to change that, I think we need to think about those questions carefully. Just my 2 cents. @visualmotive wrote:
I can not reproduced that: it seems to work as expected with current master on my side. |
@Rogdham Why does only the "projects" page fail and not the other two? Currently I am overwriting all category pages, however I might not want to in the future.
I agree with this. But some users might want to, so as a stop gap it may make sense to implement an
I agree this is a tough question, and should be considered before anything is implemented. My first idea is to say that manual content should always trump automatic content. I.E. a user defined page should win out over an automatically generated category page. Does this seem feasible? |
@Rogdham I'm encountering the same issue. Somehow, when using the
I'm at a loss at what the pagination settings would have to do with the tags page... I hope this can be resolved soon, because otherwise I can't support the new-style pagination (using |
And I still can't reproduce :-/ Here is what I've done:
Here is an example of such a markdown post:
Here is the full
And with that, no problem to generate, and the link to the first page is as it should be (http://localhost:8000/ so no page number). @dandydev: Could you test those settings see if we have a coherent behavior, and in any case provide some configuration where you got the error while generating? I would like to reproduce that bug so that I could try to fix it, but obviously I'm missing something here. |
I have created a new blog as well, following your instructions. I have the same settings as you have. I don't get an error until I add tags to an article. The combination of having tags and using the |
Hi, i'm also having a hard time making tags, categories and pagination work together. From @Rogdham test senario (fresh quickstart blog with a few sample posts), here are my observations :
So this is similar to what @dandydev already said. Pelican debug logpelicanconf.py
setup:-Python 2.7.6 |
@barraudf I can't reproduce your error, but that's probably because I have different tags, categories and test articles. But in your For Example you tag-url: So either you use:
(which works because http servers automatically send the index.html file if a folder is requested.) or
You have the same error for If this also doesn't help please let us know how your site is set up exactly (tags, categories, ...). |
Oh sorry, this works with my setup because i configured nginx accordingly:
I did this to avoid loads of directories only filled with a single But giving a try to default values for I used cat1, cat2 as category and tag1, tag2, tag3 as tags. |
+Added unit test to avoid future reproduction. The Paginator Page was keeping only the directory path for {base_name}, which means that different items (tags, categories…) were collapsing into the same file. Instead, it is now keeping everything but the extension, so that a tag (or category…) is not collapsing with an other one. Bug is likely introduced by e07b39d. Bug discovered thanks to the “no overwrite” feature.
Many thanks to @dandydev, @barraudf for the all the details added to this bug report. I finally managed to reproduce the bug, and after diving into the details, it seems that the solution is quite easy: use I believe this is an error in the doc, see the PR #1367 I just made. Edit: will not work, see comment below. @Scheirle wrote:
Some http servers automatically add the extension as well, so I think this is the rationale for @barraudf's conf. Edit: seems like @barraudf was faster than me at replying. |
My bad, the fix mentioned above does not work: it results in the list of articles being in Here is the problem (using
So the question is : how to know from Does it makes sense to “split” the |
Don't forget Categories, same issue i guess |
Ok, @Rogdham and @barraudf you are trying to do two different things (according to your description and config files): @Rogdham wants clean urls and all files are named index.html, therefore the config should look like this:
This works fine for me, as you can see here: http://blog.scheirle.de/testing/en/tag/pelican/page/2/ @barraudf instead wants that the files have the name of the slug, so the config looks like this (I added the
This also does not work for me. I assume the reason for this is, that via the In addition: for pages 2 and above all the different tags would share one page folder, which would then again lead to an overwrite of the |
@Scheirle : Even when I try setting Here is the exact pelicanconf.py used: #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'test'
SITENAME = u'test'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'Europe/Paris'
DEFAULT_LANG = u'en'
DELETE_OUTPUT_DIRECTORY = True
OUTPUT_PATH = '/var/www/blog/htdocs/'
THEME = 'notmyidea'
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
DEFAULT_PAGINATION = 3
PAGINATION_PATTERNS = (
(1, '{base_name}/', '{base_name}/index.html'),
(2, '{base_name}/page/{number}/', '{base_name}/page/{number}/index.html'),
) And a sample title: 00
date: 2014-02-10
category: cat1
tags: tag1, tag2
00
==
00 This produces the same debug output as the one I linked earlier. |
@barraudf That's because the defaults are:
And then the same error as I described above occurs. |
I'm sorry, but with DEFAULT_PAGINATION = 3
CATEGORY_URL = 'category/{slug}/'
CATEGORY_SAVE_AS = 'category/{slug}/index.html'
TAG_URL = 'tag/{slug}/'
TAG_SAVE_AS = 'tag/{slug}/index.html'
PAGINATION_PATTERNS = (
(1, '{base_name}/', '{base_name}/index.html'),
(2, '{base_name}/page/{number}/', '{base_name}/page/{number}/index.html'),
) I still get the error. Could an external setting (python or whatever) be involved? |
Did you deleted the |
Soooo, there is a cache folder! Deleting it solved the problem on the fresh quickstart site. I still have some work to do with my real site to make the theme, subcategory plugin and config file work together, but I guess i'll manage to figure them out, thanks to all these explanations. |
Caching is giving you issues, eh? By default only the content and metadata as returned by readers is cached, so I'm not sure how it could have interfered. @Scheirle, why do you think deleting the cache folder helped? Python does its own byte-compile caching in |
I got everything working. The subcategory plugin has to be configured the same way that categories and tags. The settings included in the doc don't work :
Has to be :
Theme needs a little work too if you want pagination like that :
Because some parts of urls are kind of hardcoded into the template. |
What's the consensus here? Is there any actions that should be taken with regards to this issue? |
If you get the warning saying a file is to be overwritten, you may have a config variable (*_SAVE_AS) incorrectly set |
Sorry, I still don't get it. I might me stupid or something, but I still get the following error message: TAG_URL = 'tags/{slug}.html'
TAG_SAVE_AS = 'tags/{slug}.html'
TAGS_URL = 'tags.html'
PAGINATION_PATTERNS = (
(1, '{base_name}/', '{base_name}/index.html'),
(2, '{base_name}/page/{number}/', '{base_name}/page/{number}/index.html'),
) The only way I could see this go wrong, is if I actually have a tag named index, because then |
@dandydev please re read #1223 (comment) (Your
@justinmayer As far as I can tell, all comments since 9 Feb ( #1223 (comment) ) are not related to the original issue. They only revolves around how to set |
@Scheirle I've read that comment. My Regardless if this has to do with the original issue, I'm seeing buggy behaviour and I really would like to see that sorted out. |
@dandydev: could you try the following? for
And use
This gives me the following structure: (with tags
@justinmayer: I believe this whole issue is either a problem in the documentation or in the way the impacted settings are defined. The problem is in the interactions of the I think there are two ways to solve this issue:
Finally, I believe that this quite an important issue. Because of the no-override feature, if there is a file clash, the whole blog generation breaks. I still believe that this is a good thing, for two reasons:
(×): not exactly true: it will happen for example once two different tags are set, which may not be the case at the first blog post. Just my two cents. |
@Rogdham I tried your settings with the following results:
I think the homepage (index) should be a special case. We want the index.html for the first page to end up in the root, and below that a page dir with (depending on As it stands now, |
@dandydev: you are sure about that? For reference, I just made a fresh Pelican blog from #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'me'
SITENAME = u'Title'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'Europe/Paris'
DEFAULT_LANG = u'en'
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
DEFAULT_PAGINATION = 2
TAG_URL = 'tags/{slug}.html'
TAG_SAVE_AS = 'tags/{slug}.html'
PAGINATION_PATTERNS = (
(1, '{name}.html', '{name}.html'),
(2, '{name}/page/{number}.html', '{name}/page/{number}.html'),
) And added posts that are like the following (same as in a previous message):
After a
As you can see, there is no extra I hope gave you enough details for you to be able to reproduce (btw, I used the last master of Pelican a3c8fca). It seems to work great on my end, so it would be quite frustrating if it does not on your side. |
Hi @Rogdham I tried to fiddle some more with the PAGINATION_PATTERNS = (
(1, '{name}.html', '{name}.html'),
(2, '{name}/page/{number}.html', '{name}/page/{number}.html'),
) Now I'm left with only one problem, and that is of the index page. The above PAGINATION_PATTERNS = (
(1, '{name}', '{name}.html'),
(2, '{name}/page/{number}', '{name}/page/{number}.html'),
) NGinX is configured in such a way that it tries to serve the Also, what's the difference between |
Also, when you use the settings from the documentation (substituting |
Any reaction to my latest comments? :) Pardon my french, but it seems that the PAGINATION_PATTERNS is still a mess. The feature is a lovely idea, but really doesn't work as it should yet. I really invite any contributers to clone my site and my theme and try out the PAGINATION_PATTERNS. I think it's a more useful "real world" usecase than artificially created test blogs :) |
Hello, i have a same issue to build the pull-request pythonclub/pythonclub.github.io#188 of pythonclub/pythonclub.github.io which is the correct way to fix this issue? It's very strange, the error only happens when I use the tag See full traceback: https://gist.github.com/luzfcb/42a2eb6c5d292c661d67 |
Hello, I'm having RunTimeError: File (...) is to be overwritten errors unrelated to the pagination issue, but I disagree that it should be a critical error halting the blog production process. My case is quite simple: pages or articles with duplicate titles and default {slug} settings. |
configure pelican to not use the title alone as the slug or even better, configure your urls so they can not overlap |
…'s file html overwritten
I got the same error. |
Use pelican summary plugin for summaries Failed attempt to add pagination due Bug in pagination - getpelican/pelican#1223
This issue has been around for a while, and I think the general consensus is that it is up to users to ensure that files aren't overwritten. The previous behavior silently overwrote files, so the current behavior is at least an improvement over that. If someone wants to propose a specific improvement to the current behavior, and said person is willing to implement a solution along with docs and tests if the proposal is approved, then please feel free to submit a proposal in a new issue. |
I am trying to manually overwrite an automatically generated category page (which worked in previous versions) and I get this error:
Which I think was introduced by this commit: ff7410c
Is there any way to go back to the old behavior where I was able to manually write my own page to a category page.
If not, is there a different way to accomplish what I am trying to do?
The text was updated successfully, but these errors were encountered: