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

Include directory not found when running gh-deploy #213

Closed
wragge opened this issue Feb 25, 2024 · 3 comments
Closed

Include directory not found when running gh-deploy #213

wragge opened this issue Feb 25, 2024 · 3 comments
Labels
info required Further information is requested stale No news, closing

Comments

@wragge
Copy link

wragge commented Feb 25, 2024

I'm deploying my site to GH pages organisation using mkdocs gh-deploy. As documented, you build the organisation site in a separate directory. However, when I set include_dir in the macros config, the build fails, complaining that the include directory could not be found. This seems to be because the macros plugin is looking for the include directory in the build directory rather than the site directory.

A workaround is to create a copy of the mkdocs.yml file specifically for deployment that uses a relative path to the include directory eg: ../site/includes.

Copy link

Welcome to this project and thank you!' first issue

@fralau
Copy link
Owner

fralau commented Feb 25, 2024

Thanks! I am new with mkdocs gh-deploy so I had to look up what it does, in relations to GitHub Pages (which is a Docs deployment platform not unlike Read The Docs).

This seems to be because the macros plugin is looking for the include directory in the build directory rather than the site directory.

The relevant code is here:

        # -------------------
        # Create the jinja2 environment:
        # -------------------
        DOCS_DIR = config.get('docs_dir')
        debug("Docs directory:", DOCS_DIR)
        # define the include directory:
        # NOTE: using DOCS_DIR as default is not ideal,
        # because those files get rendered as well, which is incorrect
        # since they are partials; but we do not want to break existing installs
        include_dir = self.config['include_dir'] or DOCS_DIR
        if not os.path.isdir(include_dir):
            raise FileNotFoundError("MACROS ERROR: Include directory '%s' "
                                    "does not exist!" %
                                    include_dir)
        if self.config['include_dir']:
            trace("Includes directory:", include_dir)
        else:
            debug("Includes directory:", include_dir)

What you mean by "build directory" is, I suppose the MkDocs project directory, where the original MkDocs config file is?

I suppose you defined the include_dir originally with a relative path? Perhaps mkdocs gh-deploy is getting confused because now the current directory is different. Have you tried to use an absolute path for include_dir?

@fralau fralau added the info required Further information is requested label Feb 27, 2024
@fralau fralau added stale No news, closing and removed stale No news, closing labels Mar 9, 2024
@fralau
Copy link
Owner

fralau commented Oct 11, 2024

@wragge Is the issue this relevant for you?

@fralau fralau added the stale No news, closing label Oct 19, 2024
@fralau fralau closed this as completed Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info required Further information is requested stale No news, closing
Projects
None yet
Development

No branches or pull requests

2 participants