Skip to content
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

Merged
merged 2 commits into from Jan 4, 2017
Merged

Conversation

@Kwpolska
Copy link
Member

Kwpolska commented Jan 1, 2017

This is #2613. This is an example implementation, and it may not be merged if deemed unnecessary.

cc @felixfontein, @ChillarAnand

@Kwpolska Kwpolska force-pushed the fix-2613 branch from e11c8c4 to 4e24fe9 Jan 1, 2017
return False
m = self.meta[lang].get('pretty_url', '')
return ((self.pretty_urls and m != 'False' and
self.meta[lang]['slug'] != 'index') or

This comment has been minimized.

Copy link
@felixfontein

felixfontein Jan 1, 2017

Contributor

Shouldn't self.meta[lang]['slug'] != 'index' be anded 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'))

This comment has been minimized.

Copy link
@Kwpolska

Kwpolska Jan 1, 2017

Author Member

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'))

This comment has been minimized.

Copy link
@felixfontein

felixfontein Jan 1, 2017

Contributor

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'

?

@ChillarAnand
Copy link
Contributor

ChillarAnand commented Jan 1, 2017

@Kwpolska mentioned an alternate solution here. With that solution, users have to change posts directory structure whenever pretty urls is necessary.

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>
Copy link
Contributor

felixfontein left a comment

LGTM

@Kwpolska Kwpolska merged commit b43e416 into master Jan 4, 2017
5 checks passed
5 checks passed
codacy/pr Good work! A positive pull request.
Details
continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@Kwpolska Kwpolska deleted the fix-2613 branch Jan 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.