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.48k stars 1.81k forks source link

Sharp/hash (#) symbol in the category name leads to 404 #2565

Closed Yuubari closed 5 years ago

Yuubari commented 5 years ago

I have a category that is named “C#” for posts related to the C# language. Pelican seems to name the output file c#.html and refer to that file in plain text, resulting in a request for /c that returns 404.

Is there some sort of a work-around for this?

avaris commented 5 years ago

Did you define SLUG_REGEX_SUBSTITUTIONS or CATEGORY_REGEX_SUBSTITUTIONS? If so, you removed the bit that would handle stripping #.

Yuubari commented 5 years ago

No, I am using the default set-up.

avaris commented 5 years ago

Can you share your settings file?

Default config handles it fine:

>>> from pelican.settings import DEFAULT_CONFIG
>>> from pelican.urlwrappers import Category
>>> CUSTOM_CONFIG = DEFAULT_CONFIG.copy()
>>> CUSTOM_CONFIG['CATEGORY_REGEX_SUBSTITUTIONS'] = []
>>> cat_default = Category('C#', DEFAULT_CONFIG)
>>> cat_changed = Category('C#', CUSTOM_CONFIG)
>>> cat_default.save_as
u'category/c.html'
>>> cat_changed.save_as
u'category/c#.html'
Yuubari commented 5 years ago

Here (I removed the SITE_ variables and similar cosmetic stuff):

TIMEZONE = 'Asia/Tokyo'
DEFAULT_LANG = 'en'
THEME = "pelican-themes/gum"
PLUGIN_PATHS = ['pelican-plugins']
PLUGINS = ['photos', 'more_categories', 'pelican-open_graph']
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None
DISPLAY_PAGES_ON_MENU = False
# Blogroll
LINKS = (('Azur Lane Wiki', 'https://azurlane.koumakan.jp/'),
         )
# Social widget
#SOCIAL = (('Twitter', 'https://twitter.com/Xiatian'),
#          )
DEFAULT_PAGINATION = 10

Could it be the more categories plug-in?

avaris commented 5 years ago

more_categories <- this needs update for pelican 4.

justinmayer commented 5 years ago

@Yuubari: Hopefully the fix by @oulenz will address the issue you described. In the future, please try testing with a truly stock set-up, and then gradually add plugins one-by-one, add back the custom theme, etc., as noted in the How to Get Help section of the documentation. Thanks!