Skip to content
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

Support docs from the root directory. #3450

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

athackst
Copy link
Contributor

@athackst athackst commented Oct 29, 2023

Per discussion #3062 this change would allow users to build a mkdocs site from the root directory.

This change removes the validation checks for the site directory to not be within the docs directory.
If the site folder is within the docs directory, it will mark them as 'EXCLUDED'

Tested:

  • added unit test

@athackst
Copy link
Contributor Author

athackst commented Oct 29, 2023

It might be worth considering an "ignore" option for InclusionLevel which would additionally not copy to the server, although I think the '--clean' option provides most of the benefit already.

@athackst athackst force-pushed the feat/root-dir-docs branch 2 times, most recently from fb5cd7d to 42ff3a1 Compare October 30, 2023 21:53
@oprypin
Copy link
Contributor

oprypin commented Nov 2, 2023

Thanks for pushing this forward. Sadly, I think this is too many steps that users would have to take in order to use this. If someone runs into this unprepared, confusion is fully guaranteed.
I think this --clean in particular is nasty for this, and maybe that "draft" feature was a mistake in general.
I want to more comprehensively solve all of these small issues before simply unlocking this

@athackst
Copy link
Contributor Author

athackst commented Nov 8, 2023

To be clear, it's still usable as is. A normal user would not even notice the extra site folder since nothing links to it. It just copies more than it needs to into the temp directory that serves the site.

It performs as expected on a normal build.

@athackst athackst force-pushed the feat/root-dir-docs branch 3 times, most recently from 0389e27 to 68ad2a3 Compare December 11, 2023 01:03
@athackst
Copy link
Contributor Author

@oprypin I updated this one after rebasing on top of #3476

The site directory is now appropriately marked as excluded both in build and serve.

@squidfunk
Copy link
Sponsor Contributor

Note that advertising that site_dir can be contained within docs_dir, albeit it might be supported, could break a lot of plugins that do not source their files from the Files collection, but use something like glob or other ways of enumerating files in the docs_dir. One might argue that those approaches are not idiomatic, but I've seen them more than often (and am guilty as well), so this change has quite some potential for frustration.

@athackst
Copy link
Contributor Author

I wouldn't advocate for changing the default from the 'docs' directory. I think there are legitimate use cases for wanting to call mkdocs from root though. It's a feature that's been requested a fair amount through mkdocs history.

@oprypin oprypin added this to the 1.6.0 milestone Dec 15, 2023
@oprypin oprypin marked this pull request as draft December 15, 2023 21:02
@oprypin
Copy link
Contributor

oprypin commented Dec 15, 2023

@athackst We will get this working for sure. I would like to propose a different "explicit" approach though - see #3519

@oprypin oprypin removed this from the 1.6.0 milestone Apr 9, 2024
@oprypin
Copy link
Contributor

oprypin commented Apr 21, 2024

My last conclusion on this was that the feature request is good but the exact change I wanted to be done differently.

So, I was using this PR as if it's an issue and the actual pull request I wanted to merge is #3519.
However that one got stuck - didn't go into 1.6.0 and its status is unknown.
I'll leave it because I think it's the best direction overall.

To avoid confusion, maybe this pull request should be closed and an issue opened instead.

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

Successfully merging this pull request may close these issues.

None yet

3 participants