Skip to content

Unorthodox MkDocs layouts cause docs to become stale #5559

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

Closed
orlnub123 opened this issue Apr 2, 2019 · 2 comments
Closed

Unorthodox MkDocs layouts cause docs to become stale #5559

orlnub123 opened this issue Apr 2, 2019 · 2 comments
Labels
Bug A bug

Comments

@orlnub123
Copy link
Contributor

My docs haven't been updating for a while now so I've looked into the problem. It started when I changed how they were laid out, or more specifically when I took the MkDocs configuration file out of the root folder, in this commit. The only hint was the difference at the end of the build outputs from the commit before and the commits since that successfully built.

Here's the output from the commit before:

[rtd-command-info] start-time: 2018-12-12T15:24:31.500295Z, end-time: 2018-12-12T15:24:32.154653Z, duration: 0, exit-code: 0
python /home/docs/checkouts/readthedocs.org/user_builds/django-class-settings/envs/latest/bin/mkdocs build --clean --site-dir _build/html --config-file /home/docs/checkouts/readthedocs.org/user_builds/django-class-settings/checkouts/latest/mkdocs.yml
INFO    -  Cleaning site directory
INFO    -  Building documentation to directory: /home/docs/checkouts/readthedocs.org/user_builds/django-class-settings/checkouts/latest/_build/html

And the output from the earliest successfully built commit after:

[rtd-command-info] start-time: 2019-03-06T09:01:08.583601Z, end-time: 2019-03-06T09:01:09.203502Z, duration: 0, exit-code: 0
python /home/docs/checkouts/readthedocs.org/user_builds/django-class-settings/envs/latest/bin/mkdocs build --clean --site-dir _build/html --config-file /home/docs/checkouts/readthedocs.org/user_builds/django-class-settings/checkouts/latest/docs/mkdocs.yml
INFO    -  Cleaning site directory
INFO    -  Building documentation to directory: /home/docs/checkouts/readthedocs.org/user_builds/django-class-settings/checkouts/latest/docs/_build/html

If you look closely you'll see that while the first one builds into _build/html, the one after builds into docs/_build/html. I haven't tested it but I'm guessing this discrepancy is why the docs aren't updating, even after environment resets.

The reason it's getting built into a different directory is because of the build command: https://github.com/rtfd/readthedocs.org/blob/5f78337874cb7dd0f73864d43283fe819d03594d/readthedocs/doc_builder/backends/mkdocs.py#L249-L258

The directory passed to --site-dir, self.build_dir, gets set to _build/html here: https://github.com/rtfd/readthedocs.org/blob/5f78337874cb7dd0f73864d43283fe819d03594d/readthedocs/doc_builder/backends/mkdocs.py#L294-L297

This is a problem because MkDocs assumes local paths to be local to the configuration file, not to the current working directory. The change happens here: https://github.com/mkdocs/mkdocs/blob/eb5f3f84e533cff42e13492af2a5e1ab391865e9/mkdocs/config/config_options.py#L341-L342

A fix would be to change self.build_dir to be an absolute path if the MkDocs configuration file isn't inside the root directory.

@stsewd
Copy link
Member

stsewd commented Apr 2, 2019

I already have a PR to fix this in #5539

@orlnub123
Copy link
Contributor Author

That's great! I'll take a look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug
Projects
None yet
Development

No branches or pull requests

2 participants