Browse Source

Add missing end slash when generating tag URLs (#382)

Matt Westcott 2 years ago
parent
commit
25c9fb17e5
1 changed files with 2 additions and 3 deletions
  1. 2 3
      bakerydemo/blog/models.py

+ 2 - 3
bakerydemo/blog/models.py

@@ -109,10 +109,9 @@ class BlogPage(Page):
         We're additionally adding a URL to access BlogPage objects with that tag
         """
         tags = self.tags.all()
+        base_url = self.get_parent().url
         for tag in tags:
-            tag.url = "/" + "/".join(
-                s.strip("/") for s in [self.get_parent().url, "tags", tag.slug]
-            )
+            tag.url = f"{base_url}tags/{tag.slug}/"
         return tags
 
     # Specifies parent to BlogPage as being BlogIndexPages