-
Notifications
You must be signed in to change notification settings - Fork 2
Pass page.url to relativize_links() for consistent value when site_url
not configured
#9
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
base: main
Are you sure you want to change the base?
Conversation
Hey Martin, |
The behaviour of Passing Therefore this change introduces bugs when parsing the path later on in the script. I think your last change needs to be improved further. However, tests would be much appreciated and would have helped to debug this issue! |
Yes I found the value of Can I ask which command you were running in your testing? Could I request you run your manual debugging again but doing it for both the |
Sorry, I forgot about the issue when finding the other one 😅 However, I cannot reproduce it. This is what I did: I added a debug statement to the plugin that prints Then I build the plugin with |
By the way: I have restructured the project according to the PyTest docs. You can now write tests inside /tests and run them with |
Oh good work! Let me figure out what's going on with this inconsistency I am observing. I will make a new blank project and add in my config 1-by-1 until I discover what is the cause of this inconsistency. |
OK, I have made a discovery...... The So @SaltyAimbOtter if you repeat your experiment in the BetonQuest/BetonQuest repo, but delete line 4 of |
OK. I think the bug might be in this line https://github.com/mkdocs/mkdocs/blob/master/mkdocs/structure/pages.py#L72
|
dd30089
to
96743b3
Compare
site_url
not configured
Hi @SaltyAimbOtter, I have done some more debugging and discovered the |
I observed that links in snippets would be generated correctly when using
mkdocs serve
locally, but if you ranmkdocs build
to make the static HTML files, the links were missing their relative path prefixes (eg.../
).After some debugging I noticed that when the
site_url
property is not set inmkdocs.yml
, the value ofpage.abs_url
differs between the 2 commands; it isNone
when runningbuild
, but it is a string path when runningserve
. (Note: Ifsite_url
is set inmkdocs.yml
,page.abs_url
is the same across both these commands).This means that when I raised #7 a couple of weeks ago which added handling for
current_path
variable being empty I was actually not fixing the root cause of the problem.This PR changes it to use
page.url
which I have observed being consistent between the 2 commands, regardless of ifsite_url
is or is not set inmkdocs.yml
Sadly, I cannot contribute tests to cover all the logic in
relativize_links()
because I do not know the expected behaviour of functions likeremove_mike_version_from_path()
.