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

mkdocs in a subdir #2026

Open
Mopster opened this issue Mar 19, 2020 · 5 comments
Open

mkdocs in a subdir #2026

Mopster opened this issue Mar 19, 2020 · 5 comments

Comments

@Mopster
Copy link

@Mopster Mopster commented Mar 19, 2020

I might be missing something very obvious here. We have a Symfony project and want to offer the mkdocs site in a subfolder : www.domain.com/solutions/index.php

My doc structure :

  • docs
    • solutions
      • EN
        • ....
      • JA
        • ...
      • index.md

mkdocs.yml is in the root of the project

docs_dir: docs/solutions/
site_dir: web/solutions/

I run mkdocs build in the the project root, and it generates the html files etc...

The problem is all the links in the html files (links to CSS, JS and other page) start as en/folder/page.html and ja/folder/page2.html while I need all those links to be prefixed by 'solutions/` is there any way to get this ?

@waylan

This comment has been minimized.

Copy link
Member

@waylan waylan commented Mar 19, 2020

That is not necessary. The URLs are all relative. In other words, MkDocs is aware of the location of the current page and builds the URL to ensure it points from the current location to the other location. Therefore, they will work correctly regardless of whether they are hosted in a sub-directory or not. However, you will need to properly set the site_url setting: https://example.com/solutions/. Note that the sub-directory is included there. That won't change how the links get rendered, but it will ensure everything does work as it should.

@Mopster

This comment has been minimized.

Copy link
Author

@Mopster Mopster commented Mar 22, 2020

It seems it's not possible to add a relative URL to the site_url. The problem is that URL is different for each customer, we run a multi-tenancy system based on the subdomain, we can't put it on a unique URL since we want to make authentication required to access the pages (using the Symfony authentication and firewall). Is there a way ?

@waylan

This comment has been minimized.

Copy link
Member

@waylan waylan commented Mar 23, 2020

It sounds to me like you need to use multiple MkDocs projects. Each one would have a unique site_url.

@Mopster

This comment has been minimized.

Copy link
Author

@Mopster Mopster commented Mar 23, 2020

We run the multi-tenant system out of a single repository/document root (with multiple DB's, connection based on subdomain). So having a different config for each unique site_url is not possible.
Would it be possible to expand the config to allow a site_path parameter which would be default empty, and have it appended to the site_url ?

@waylan

This comment has been minimized.

Copy link
Member

@waylan waylan commented Mar 23, 2020

Having separate config for each is the only way it will work.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.