Skip to content

Add STRIP_EXTENSIONS config item#3866

Open
jwise wants to merge 1 commit into
getnikola:masterfrom
jwise:jwise/strip_extensions
Open

Add STRIP_EXTENSIONS config item#3866
jwise wants to merge 1 commit into
getnikola:masterfrom
jwise:jwise/strip_extensions

Conversation

@jwise

@jwise jwise commented Oct 17, 2025

Copy link
Copy Markdown

Pull Request Checklist

  • I’ve read the guidelines for contributing.
  • I updated AUTHORS.txt and CHANGES.txt (if the change is non-trivial) and documentation (if applicable).
  • I tested my changes.

Description

This implements #3865 -- as seen in production on https://joshuawise.com/ .

Fix getnikola#3865.

Signed-off-by: Joshua Wise <joshua@joshuawise.com>

@felixfontein felixfontein left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

Comment thread nikola/post.py
if self.strip_indexes and link[-(1 + index_len):] == '/' + self.index_file:
link = link[:-index_len]
if self.strip_extensions and link[-len(extension):] == extension:
link = link[:-len(extension)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While above you explicitly handle .html, here you handle general extensions. This doesn't fit together.

How about making STRIP_EXTENSIONS a list instead that provides a list of extensions that will be stripped? Then users can explicitly configure to strip .html but not .php, or both, or ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants