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
Fix #2613 — allow enabling pretty URLs with per-post setting #2614
Conversation
return False | ||
m = self.meta[lang].get('pretty_url', '') | ||
return ((self.pretty_urls and m != 'False' and | ||
self.meta[lang]['slug'] != 'index') or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't self.meta[lang]['slug'] != 'index'
be and
ed with both sides of or
? I.e. something like
return self.meta[lang]['slug'] != 'index' and ((self.pretty_urls and m != 'False') or (not self.pretty_urls and m == 'True'))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be, but if you are specifying pretty_url
as a special case, you probably don’t want it overridden by some magic. In fact, we could go the other way: allow index
to create a pretty URL if there is an override, even if self.pretty_urls is True. Which way should I go?
m = self.meta[lang].get('pretty_url', '') | ||
return ((self.pretty_urls and m != 'False' and | ||
self.meta[lang]['slug'] != 'index') or | ||
(not self.pretty_urls and m == 'True')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not replace the whole logic with:
m = self.meta[lang].get('pretty_url', repr(self.pretty_urls))
return self.meta[lang]['slug'] != 'index' and m == 'True'
?
@Kwpolska mentioned an alternate solution here. With that solution, users have to change I prefer this fix as directory structure can remain same. But its up to you to decide. |
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This is #2613. This is an example implementation, and it may not be merged if deemed unnecessary.
cc @felixfontein, @ChillarAnand