Github Pages with Sphinx generated documentation not displaying HTML correctly - github

I have been trying to publish a Sphinx generated documentation for our repository on Github pages with the theme provided by readthedocs.org.
After a few attempts I managed to get it online by uploading the Sphinx generated HTML files in the gh-pages branch of the repository.
Obtaining this:
https://takeqontrol.github.io/qontrol_api/
Which is looking awful, erasing all the customization of the theme by Read the Docs.
Here is an example of what you see if you open the link:
But if I open those HTML files on my computer the pages looks exactly how I wanted them to look.
Here is an example of how exactly the same HTML looks locally:
Does anybody know what is going on? Or even point me somewhere where I can find an explanation?
All the code is available here: https://github.com/takeqontrol/qontrol_api
in the two branches.

I fought with this for 9 hours before figuring out that the underscore in the _static folder was causing the issue.
You need to by pass Jekyll on github pages.
To do this, add an empty .nojekyll to your gh-pages branch. (See example)

I was having a similar issue and then found this, which solved it for me:
Python Sphinx css not working on github pages
Looks like using underscores for the _sources + _static folder caused the issues. Need to rename the folders and paths using them in the html files accordingly.

Related

Github prepends "https://github.com/user/repo/blob/main/" to all links in readme.md

I have a private repository on GitHub that contains a readme.md file with links to Kaggle datasets. When viewing the repo on github prepends "https://github.com/{user}/{repo}/blob/main/" to the url, breaking it.
Why is this happening, and how do I change this behavior?
For what it's worth, I'm also using git-lfs, though I can't find any documentation of this behavior associated with that, either.
I ended up figuring this out on my own. The URL was missing a scheme, and github was treating it like a relative link to something in the repository. This was my mistake and not an issue with github.

Gh-pages not displaying the right thing

I'm having some issues with getting the proper page to display. I've looked up different answers and they don't seem to be working for me.
https://github.com/samus94/portfolio2.1
Please let me know what I've done wrong here.
It was displaying the readme before, and I think it still is.
First, You've posted a link to your GitHub repository, not your GitHub Page. The address for GitHub pages always looks like https://<yourname>.github.io/<reponame>.
To get this URL you can go into the settings for your repo and find the GitHub Pages section. Make sure you have GitHub Pages enabled, then look for the URL your site is published at.
Finally, GitHub Pages requires your repository have a very specific structure. It expects there to be an index.html file at the root of the repository. This means you have to either move everything in your /src directory to the root, or move the index.html and update the URLs to your javascript and CSS.
All of these requirements are outlined clearly in the GitHub Pages documentation.
Deploying static HTML + CSS + JS sites (NO jekyll) to Github Pages,
using Github Actions was harder than I though.
Theres is very few quality documentation about this specific topic, except this one:
Steps overview:
Setup a custom action in github
Push changes and the action executes automatically
Your page is deployed to github pages
One important thing: I had no need of changing any property in the yml; don't worry about customizations.

GitHub Markdown - Add current branch name

Just a short question:
Is it possible to show the current branch name in e.g. README.md automatically with a placeholder or something like that using GitHub Flavored Markdown?
No, I'm not aware of anything like that within READMEs or any other markdown documents when browsing through the source of your project. And nothing turns up when searching their help page either.
However, GitHub Pages offers all sorts of info about the repo the document is associated with. Of course, GitHub Pages is a very different thing than a README file, so that may or may not be helpful to you.

GitHub: Linking to an issue from a wiki page

On GitHub, is there a simple way to reference an issue (eg: #1234) from within a markdown file such that it is displayed as a hyperlink?
I don't want to write out the full form each time, as in:
[#1234](//github.com/user/project/issues/1234)
In commit messages, issue numbers are automatically hyperlinked. Can this happen in wiki documents too?
(This is not a duplicate of this question which is simply asking about markdown hyperlink syntax.)
It doesn't happen in wiki documents.
You can use a relative url but it isn't that much of a shortcut. It also depends on where you are in the project.
For example in the Readme.md in the master branch of the project:
[#1](../../issues/1)
On the github wikis:
[#1](../issues/1)
Anywhere:
[#1](/user/project/issues/1)
(h/t to VertigoRay for suggesting this)

GitHub wiki directories

Does the wiki that installs with a GitHub repo support directories? Our wiki is cluttered with pages, and we are looking for a way to organize them better.
We tried pulling the repo, creating local directories, and moving things around, but when committed back, the wiki didn't pick up the changes.
I was having the exact same issue and tried variants of what you tried. Nothing stuck. Asked GitHub support about it and received a reply that essentially said "No, but we'll let the developers know that people are interested in this feature."
So the short answer is "No", and the long answer is "No, but maybe in the future."
Actually, it looks like github added support for directories recently.
I was able to do the following:
Move an existing markdown file to a new directory.
Create a new markdown file in an existing directory (created in the former step).
Create a new markdown file in a new directory.
In all cases, the existing pages were still there and new pages were added.
The one constraint that remains is that your file names must be unique. If you have more than one file with the same name, only one of them will show up in the wiki (I'm not sure which.. ).
The GitHub wiki (aka Gollum) does use directories but not in the way you may expect.
The documentation on the Gollum wiki could use some work but this is what I have figured out mostly via testing.
All files appear in the root of the wiki no matter where they are placed in the repo.
_Header, _Footer and _Sidebar files are per-directory, but inherited if there is
none present in a child folder.
File links can be relative to the source file (keep your files with your content).
So, if you want directories for namespacing you are out of luck. Consider using the {namespace}-{page} scheme for namespacing.
It's not the an ideal solution but the workaround would be to create a custom sidebar where you create a table of contents with links to your pages. I find this to be better than folders anyway because it allows you to have a link to a single page under multiple hierarchies.
Actually, there is still a limitation. Yes, you can add 1 level (so, 1 subfolder). But that's it! I refactored my whole documentation layout, creating multiple levels of subfolders for organisation, but that was a no-go.
sigh
I must say: I'm appalled by this Gollum thing. I'm surprised Github even picked it up.
Well, that's a disappointing missing feature!
What I try to do is to actually have directories under a docs directory and in each one, a README.md file.
Not great...but works for documentation and organizes stuff.
If you want to go further, you can have a different branch only with these files.
Still no intention of adding this 9/2022.
https://github.com/orgs/community/discussions/23914