This repository has been archived by the owner on Mar 26, 2024. It is now read-only.
Enable html_link_suffix #22
Closed
Closed
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,8 @@ def make_aggregated_pages(app): | |
"next": {}, | ||
"posts": [] | ||
} | ||
|
||
context["html_link_suffix"] = app.config.html_link_suffix | ||
|
||
# add posts to context | ||
for post in posts: | ||
|
@@ -50,7 +52,7 @@ def make_aggregated_pages(app): | |
# following pages prev-link to previous page (titled as "Newer") | ||
pagename = "page%d" % (i + 1) | ||
context["prev"]["title"] = UIStr.NEWER | ||
context["prev"]["link"] = "index.html" if i == 1 else "page%d.html" % i | ||
context["prev"]["link"] = "index" if i == 1 else "page%d%s" % (i, context["html_link_suffix"]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't index also get an extension? |
||
context["title"] = UIStr.PAGE_FMT % (i + 1) | ||
|
||
if i == len(groups) - 1: | ||
|
@@ -59,7 +61,7 @@ def make_aggregated_pages(app): | |
else: | ||
# other pages next-link to following page (titled as "Older") | ||
context["next"]["title"] = UIStr.OLDER | ||
context["next"]["link"] = "page%d.html" % (i + 2) | ||
context["next"]["link"] = "page%d%s" % ((i + 2), context["html_link_suffix"]) | ||
|
||
context["archive_title"] = UIStr.BLOG_ARCHIVE | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,7 @@ def __init__(self): | |
self.author = None | ||
self.filing = { "tags": [], "categories": [] } | ||
self.comments, self.comment_count = False, False | ||
self.html_link_suffix = None | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, are these changes really needed here? Metadata should be specific to one post (like its title or author). The suffix is a global so it will be the same for all instances of Metadata. Wouldn't it make more sense to just pull the value from app.config whenever we need it? |
||
self.num = Metadata.num | ||
Metadata.num += 1 | ||
|
||
|
@@ -98,6 +99,7 @@ def get_metadata(app, docname): | |
if not match: | ||
return | ||
|
||
metadata.html_link_suffix = app.config.html_link_suffix | ||
metadata.is_post = True | ||
metadata.link = docname | ||
metadata.date = datetime.datetime.strptime(match.group(), "%Y/%m/%d/") | ||
|
@@ -156,6 +158,9 @@ def add_metadata(app, pagename, context): | |
# page data | ||
context['website'] = app.config.website | ||
|
||
# blog html link suffix | ||
context["html_link_suffix"] = app.config.html_link_suffix | ||
|
||
# blog tagline and pages | ||
context["tagline"] = app.config.tagline | ||
context["description"] = app.config.description | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Does the suffix have to go into the context? The context gets sent to Jinja so it can be accessed from the templates but I don't see any reference to it in the templates. Can't we just use the value from app.config directly?