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

Add slugify.paths_keep_dates option. Update docs. #1955

Merged
merged 3 commits into from Aug 24, 2022
Merged

Conversation

DerSaidin
Copy link
Contributor

Manual testing:

Existing test_site/config.toml

http://127.0.0.1:1111/posts/a-post-with-dates

====

--- a/test_site/config.toml
+++ b/test_site/config.toml
@@ -18,6 +18,7 @@ extra_syntaxes_and_themes = ["syntaxes", "highlight_themes"]

 [slugify]
 paths = "on"
+paths_keep_dates = true
 taxonomies = "on"
 anchors = "on"

http://127.0.0.1:1111/posts/2016-10-08-a-post-with-dates

====

--- a/test_site/config.toml
+++ b/test_site/config.toml
@@ -17,7 +17,8 @@ highlight_theme = "custom_gruvbox"
 extra_syntaxes_and_themes = ["syntaxes", "highlight_themes"]

 [slugify]
-paths = "on"
+paths = "off"
+paths_keep_dates = true
 taxonomies = "on"
 anchors = "on"

http://127.0.0.1:1111/posts/2016-10-08_a-post-with-dates

====

--- a/test_site/config.toml
+++ b/test_site/config.toml
@@ -17,7 +17,8 @@ highlight_theme = "custom_gruvbox"
 extra_syntaxes_and_themes = ["syntaxes", "highlight_themes"]

 [slugify]
-paths = "on"
+paths = "safe"
+paths_keep_dates = true
 taxonomies = "on"
 anchors = "on"

http://127.0.0.1:1111/posts/2016-10-08_a-post-with-dates

Sanity check:

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

  • Are you doing the PR on the next branch?

  • Have you created/updated the relevant documentation page(s)?

Proposal thread:
https://zola.discourse.group/t/proposal-config-option-to-keep-dates-in-slugs/1405

@Keats
Copy link
Collaborator

Keats commented Aug 9, 2022

Can you rebase the PR?

@DerSaidin
Copy link
Contributor Author

(oops, deleted the next branch in my fork when I synced it)

Rebased.

Copy link
Collaborator

@Keats Keats left a comment

Choose a reason for hiding this comment

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

I think you will need to rebase the commit again, sorry.

It looks ok except I would have preferred if the setting was section-wide rather than config-wide to make it more specific.

# Whether to remove date prefixes for page path slugs.
# For example, content/posts/2016-10-08_a-post-with-dates.md => posts/a-post-with-dates
# When true, content/posts/2016-10-08_a-post-with-dates.md => posts/2016-10-08-a-post-with-dates
paths_keep_dates = false
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just bike shedding on the name: anyone has a better name? I'm not too sold on this one

Manual testing:

Existing test_site/config.toml

http://127.0.0.1:1111/posts/a-post-with-dates

====

--- a/test_site/config.toml
+++ b/test_site/config.toml
@@ -18,6 +18,7 @@ extra_syntaxes_and_themes = ["syntaxes", "highlight_themes"]

 [slugify]
 paths = "on"
+paths_keep_dates = true
 taxonomies = "on"
 anchors = "on"

http://127.0.0.1:1111/posts/2016-10-08-a-post-with-dates

====

--- a/test_site/config.toml
+++ b/test_site/config.toml
@@ -17,7 +17,8 @@ highlight_theme = "custom_gruvbox"
 extra_syntaxes_and_themes = ["syntaxes", "highlight_themes"]

 [slugify]
-paths = "on"
+paths = "off"
+paths_keep_dates = true
 taxonomies = "on"
 anchors = "on"

http://127.0.0.1:1111/posts/2016-10-08_a-post-with-dates

====

--- a/test_site/config.toml
+++ b/test_site/config.toml
@@ -17,7 +17,8 @@ highlight_theme = "custom_gruvbox"
 extra_syntaxes_and_themes = ["syntaxes", "highlight_themes"]

 [slugify]
-paths = "on"
+paths = "safe"
+paths_keep_dates = true
 taxonomies = "on"
 anchors = "on"

http://127.0.0.1:1111/posts/2016-10-08_a-post-with-dates
@DerSaidin
Copy link
Contributor Author

Rebased again.

I'm happy to change the name if we have a better candidate :)
I guess that can also happen later - up until it is merged to master?

@Keats
Copy link
Collaborator

Keats commented Aug 24, 2022

I'm happy to change the name if we have a better candidate :)
I guess that can also happen later - up until it is merged to master?

Yep, we have time

@Keats Keats merged commit d196d8a into getzola:next Aug 24, 2022
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.

None yet

3 participants