Fixed issue with OS-specific paths in tags plugin

This commit is contained in:
squidfunk 2022-05-01 16:39:06 +02:00
parent fd60d5bdae
commit 43a6d929ce

View File

@ -107,15 +107,15 @@ class TagsPlugin(BasePlugin):
content = [f"## <span class=\"md-tag\">{tag}</span>", ""] content = [f"## <span class=\"md-tag\">{tag}</span>", ""]
for page in pages: for page in pages:
url = utils.get_relative_url( url = utils.get_relative_url(
page.file.src_path, page.file.src_path.replace(os.path.sep, "/"),
self.tags_file.src_path self.tags_file.src_path.replace(os.path.sep, "/")
) )
# Ensure forward slashes, as we have to use the path of the source # Ensure forward slashes, as we have to use the path of the source
# file which contains the operating system's path separator. # file which contains the operating system's path separator.
content.append("- [{}]({})".format( content.append("- [{}]({})".format(
page.meta.get("title", page.title), page.meta.get("title", page.title),
url.replace(os.path.sep, "/") url
)) ))
# Return rendered tag links # Return rendered tag links