You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for writing this plugin! I ran some tests with it and all seemed fine while hosting the MkDocs site files from the root of the website, e.g. site_url: https://www.example.com in mkdocs.yml. However, I found that the plugin does not work properly when hosting the files in a subdirectory of the site. E.g. site_url: https://www.example.com/subdir.
The problem lies in the fact that the plugin generates absolute links. Meaning: the category links on the category index page are always prefixed with /categories; it does not take the subdir in account. The same is true for the category pages (which contain links to the pages on which the category is used on) and the 'normal' pages, on which the categories of that page are listed.
The MkDocs documentation states that absolute paths with links are not officially supported (source) and that relative paths are to be used.
I prepared a small patch which makes the plugin generate relative links. Could you please take a look at it and share your thoughts? Thanks!
Hi @rpmzandwijk, thanks so much for the patch, and sorry for the late response! I'm testing your changes on my wiki, and they work great. I did have to modify one line slightly to read:
lambdap: f"- [{p['title']}](../../{p['url']}/)",
Notice the trailing slash. If you stick your main index.md page into a category, MkDocs would complain about the path of .. being invalid. Adding a trailing slash fixed that.
I also replaced the added for-loop with the already existing map() function, but with your modified code added in.
I will push the changes out in the next patch release, 0.2.1, so keep an eye out for that later today. Thanks again for the changes; it's nice to know that real humans other than myself are using the plugin!
Hi @EddyLuten,
Thanks for writing this plugin! I ran some tests with it and all seemed fine while hosting the MkDocs site files from the root of the website, e.g.
site_url: https://www.example.com
inmkdocs.yml
. However, I found that the plugin does not work properly when hosting the files in a subdirectory of the site. E.g.site_url: https://www.example.com/subdir
.The problem lies in the fact that the plugin generates absolute links. Meaning: the category links on the category index page are always prefixed with
/categories
; it does not take the subdir in account. The same is true for the category pages (which contain links to the pages on which the category is used on) and the 'normal' pages, on which the categories of that page are listed.The MkDocs documentation states that absolute paths with links are not officially supported (source) and that relative paths are to be used.
I prepared a small patch which makes the plugin generate relative links. Could you please take a look at it and share your thoughts? Thanks!
-Remy
plugin.py.patch.txt
The text was updated successfully, but these errors were encountered: