-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
How to use github pages from master /docs folder elegantly with sphinx #3382
Comments
It's generally disputable whether committing build results is elegant. This question aside, here's a solution:
|
Sorry, this is a bug tracker of Sphinx, not a forum. BTW, I feel Please let me know if you get a good way to do that. I will add it to our document. Thanks, |
Update of @TimKam This worked fine for me.
|
Sorry to bump an old issue but.... I am currently using @suhailvs (Tysm ^_^) method and it's working fine like GitHub docs are being built like this: https://ritabratamaiti.github.io/RapidML and the readthedocs page is working fine too: https://rapidml.readthedocs.io/en/latest/ |
We use the method detailed by @suhailvs (Thank you!) and it works fine as well. With respect to the question of SEO when we publish links to the documentation we do not use the https://.github.io/ url but rather the https://.github.io//html/ url. We put the later url in the README.md file in the main repo as well. That way web crawlers should go directly to the sphinx pages without the redirect. The redirect as given in the last step by @suhailvs is simply a convenience step for people used to the jekyll way of doing things. |
@suhailvs Thanks! I only:
And I don't need to do anything else, just |
update of @wxianxin
|
Can we please reopen this issue? I realise it was previously closed per not being a forum, though isn't there a legitimate case for providing the option to build the HTML to a specific directory for compatibility with GitHub pages? |
* Renamed doc folder to docs * Added docs/.nojekyll file * Added docs/index.html with redirect to docs/html/index.html * Moved docs/Makefile to repository root (and adjusted it consistently with rest of SamsungSLAV repositories) * Moved docs/sphinx contents to docs/ directly * Changed build directory from docs/build to docs/ * Moved docs/docker/Dockerfile for building documentation to docs/Dockerfile directory for consistency with other SamsungSLAV repositories * Adjusted Makefile after directory changes We should always link to: samsungslav.github.io/muxpi/html/ NOT to: samsungslav.github.io/muxpi/ (which works, but due to redirect is not SEO-friendly) I had used this thread as reference: sphinx-doc/sphinx#3382 Change-Id: I782507b8cdf1ffbdc8a8825a1530b9977bef196b Signed-off-by: Alexander Mazuruk <[email protected]>
* Renamed doc folder to docs * Added docs/.nojekyll file * Added docs/index.html with redirect to docs/html/index.html * Moved docs/Makefile to repository root (and adjusted it consistently with rest of SamsungSLAV repositories) * Moved docs/sphinx contents to docs/ directly * Changed build directory from docs/build to docs/ * Moved docs/docker/Dockerfile for building documentation to docs/Dockerfile directory for consistency with other SamsungSLAV repositories * Adjusted Makefile after directory changes We should always link to: samsungslav.github.io/muxpi/html/ NOT to: samsungslav.github.io/muxpi/ (which works, but due to redirect is not SEO-friendly) I had used this thread as reference: sphinx-doc/sphinx#3382 Change-Id: I782507b8cdf1ffbdc8a8825a1530b9977bef196b Signed-off-by: Alexander Mazuruk <[email protected]>
Having just spent a lot of time trying to get Sphinx documentation to render correctly on Github Pages before belatedly discovering the working procedure described above by @suhailvs, I would support the call to re-open this issue until it is resolved by updating the documentation and upgrading the currently ineffective «githubpages» extension. |
Reopened. But I don't understand what I should do. Can anyone send a PR for this? |
I will try to help. |
Hey, idk if this is any better, or maybe even worse than the redirect approach, but another option that worked for me...
This approach also helps to avoid committing other build artifacts that you may not want to commit, like the doctrees pickle files. |
In your project repo create two directories, docsrc and docs. In docsrc, initialize sphinx. Add docsrc/_build/ to your .gitignore Add the following to the Makefile that sphinx generated for you under docsrc/Makefile github: @make html @cp -a _build/html/. ../docs Then you can run make github from the docsrc directory to generate the docs and move them to where GitHub wants them.
@jason-huling , By adding the
How did you address this error? |
So I figured out: if you are on Windows, then you should edit your
After the following line:
And then you can enter |
sphinx-doc/sphinx#3382 Look at suhailvs commented on Jun 8, 2018
Setup to publish to GitHub pages per sphinx-doc/sphinx#3382 (comment)
Follow instructions from these sources: https://www.docslikecode.com/articles/github-pages-python-sphinx/ sphinx-doc/sphinx#3382 (comment)
…thub pages docs with sphinx
Docs! * Add rendered docs for gh-pages delivery Scheme based on sphinx-doc/sphinx#3382 (comment) * Makefile support for gh-pages hosted docs N.B. we require user to have sphinx installed globally at the moment. That is somewhat reasonable, as Rust language uses sphinx for documentation. If we end up wanting specific sphinx extensions, we'll have to add those requirements to a (not yet in existence) requirements-dev.txt.
* 📚 Replace pdoc3 with sphinx docs * 👀 Add hint for github to ignore kekyll rendering * 🎨 Remove warning * 📚 Add redirect to sphinx custom html dump. Reference: https://github.com/sphinx-doc/sphinx/issues/3382\#issuecomment-408426538 * 🔧 * 🔧 Unignore docs artifacts * 📚 * 🚀 Update docs target * 🔧 * 🎨 Style Changes
Followed this response sphinx-doc/sphinx#3382 (comment) to try to make GitHub pages work
MkDocs has a built in |
Hey, @johnthagen , your comment reminded me of how I love mkdocs for this feature and how badly I miss it with sphinx. Mkdocs use Here is what you need to do:
|
you may want to run before @cp create a new line with:
|
I am not sure why this has not been mentioned but using GitHub Actions this has a quite elegant solution. name: "Documentation"
on: [push, pull_request]
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: sphinx-toolbox/sphinx-action@master
with:
pre-build-command: "pip install .[docs]"
docs-folder: "docs/"
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/master'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html As a side note, there are a few different Actions that can be used to deploy to github pages but |
Summarised actionable content from this issue in #10472. A |
Problem
What I'd like to do is in the
master
branch of my github repo, have a/docs
directory which within it, has a sphinx project. I'd like to be able to update the docs with only acd docs
andmake html
. Github pages doesn't allow you to choose arbitrary directories, otherwise I would set github pages to use/docs/build/html
.My principal question is: is it possible to use the command
make html
without creating a new html folder, but dump all the files in the directory specified by theBUILDDIR
variable in the Makefile? Is there an option inSPHINXBUILD
which will let me do this?My more general question is: how do people in practice using github pages (from
master
branch,/docs
folder) set up sphinx? I can't seem to find documentation of anyone trying to accomplish this, and the documentation to do related things (e.g. using agh-pages
branch) seems kind of out of date.Thanks!
The text was updated successfully, but these errors were encountered: