CONTRIBUTING.md does not render as a web page on github pages - github

i'm in the process of moving my contributing.md file from the project root to the docs/ directory so it can be with the rest of the documentation. Other markdown files in docs render properly when viewed in github pages. For example, the page
https://jtablesaw.github.io/tablesaw/userguide/toc
renders the page toc.md as expected.
however,
https://jtablesaw.github.io/tablesaw/contributing
returns a 404, while simply adding the .md extension
https://jtablesaw.github.io/tablesaw/contributing.md
returns the page as markdown source
The github project is https://github.com/jtablesaw/tablesaw.
and the contributing.md file is in the docs/ folder.

Zachary's answer is correct but there is a way to modify the jekyll's configuration to include the specific page.
Here is an example: https://masterex.github.io/test-docs/contributing
You have to modify _config.yml as follows:
theme: jekyll-theme-minimal
include: contributing.md
Here is github's relevant help page.

After forking your repo, playing around with it for a bit, and banging my head against the wall because I didn't understand why it wasn't working, I realized something:
Github Pages doesn't support building Jekyll pages from files that have names that Github recognizes for other purposes. These file names include (in addition to their lowercase versions):
CONTRIBUTING.md
ISSUE_TEMPLATE.md
PULL_REQUEST_TEMPLATE.md
ISSUE_AND_PULL_REQUEST_TEMPLATE.md
CODEOWNERS.md
On the other hand, despite that README.md is also a Github keyword file, it looks like Github Pages supports using files with the README.md name because it purposely will interpret them the same way as an index.md or index.html file. See this link from the Github blog for more information.
To answer your specific question on how you could get the file to show at the /tablesaw/contributing path, you could rename it and move it to the /docs/contributing/index.md or /docs/contributing/README.md path.
U̶n̶f̶o̶r̶t̶u̶n̶a̶t̶e̶l̶y̶,̶ ̶a̶t̶ ̶l̶e̶a̶s̶t̶ ̶i̶n̶ ̶t̶h̶e̶ ̶p̶r̶e̶s̶e̶n̶t̶,̶ ̶t̶h̶e̶r̶e̶'̶s̶ ̶c̶u̶r̶r̶e̶n̶t̶l̶y̶ ̶n̶o̶ ̶w̶a̶y̶ ̶t̶o̶ ̶k̶e̶e̶p̶ ̶i̶t̶ ̶w̶i̶t̶h̶ ̶t̶h̶e̶ ̶s̶a̶m̶e̶ ̶f̶i̶l̶e̶ ̶n̶a̶m̶e̶ ̶a̶n̶d̶ ̶h̶a̶v̶e̶ ̶G̶i̶t̶h̶u̶b̶ ̶P̶a̶g̶e̶s̶ ̶b̶u̶i̶l̶d̶ ̶a̶ ̶p̶a̶g̶e̶ ̶f̶o̶r̶ ̶i̶t̶.̶
Edit: #Master_ex notes correctly that you can use the include configuration option in the _config.yml file to include files that would normally be excluded by Github:
theme: jekyll-theme-minimal
include: contributing.md
In reference to the original example, this will allow Github Pages to build a page successfully at the /docs/contributing path.

Related

Unable to host project to GitHub Pages

My repo: https://github.com/shoegazzz/simple-trello-clone
When following a link https://shoegazzz.github.io/simple-trello-clone/ :
404 File not found The site configured at this address does not contain the requested file. If this is your site, make sure that the filename case matches the URL. For root URLs (like http://example.com/) you must provide an index.html file. Read the full documentation for more information about using GitHub Pages.
I read the documentation, watched videos and discussions on the topic, renamed the repository to the username, but it still does not work. Tell me what should be done here?
first things first: please leverage the usage of the .gitignore file (in the root directory of your repository). You can copy-paste the content provided in this file: https://github.com/github/gitignore/blob/main/Node.gitignore into your .gitignore file. This will ignore the node_modules directory from getting staged and ultimately from getting pushed into the repository.
Now, the problem you described occures when there is no information for GitHub Pages. GitHub Pages is searching for an index.html which isn't there, as by default GitHub Pages is watching the root directory of your repository.
Please have a look at GitHub Actions to Deploy your project to GitHub Pages. This is the best source I could find in a short matter of time: https://github.com/gitname/react-gh-pages
If you have any follow-up questions, feel free to ask.
TL;DR: You need to provide the built static-website content for GitHub Pages to work with.

Is the `config.yml` file what I need to customize the organization templates for the new-issue page on GitHub?

This pylance GH link renders the new-issue page as
whereas my own new-issue page is rendered as
which, I guess, is using some kind of blank-issues
per GH doc, I need to add a config.yml file to the .github/ISSUE_TEMPLATE folder.
However, there isn's a config.yml file in pylance GH .github/ISSUE_TEMPLATE folder.
Is the config.yml file what I need for the new-issue page pointed out by the red arrow? or I misunderstood the GH doc?
The config.yml is used to generate links outside of Github. For example to invite users to use stackoverflow to ask question instead of the github issues.
To add template choices (as you have in the red square), you will have to add template files in the form of .md files in the .github/ISSUE_TEMPLATE folder. You can see example of those template files in the pylance GH .github/ISSUE_TEMPLATE folder

Apply GitHub pages theme on existing html

I have an existing GitHub project that already had a few html pages. Now I made a GitHub pages site of the project using the docs folder in the master branch but when I try to apply an existing jekyll theme to the pages, the theme is not applied. The docs folder contains a file named index.html.
Do I need to add some kind of import statement to my html pages or do I really need to convert them to markdown syntax? Maybe I am doing something wrong here?
The GitHub project is found here
The GitHub pages site for my project is here
From a plain HTML website to a Jekyll website
If you want a plain html website to use layouts, you start your html pages with:
---
layout: page
---
You can freely rename your files from .html to .md, as it is allright for .md pages to contain HTML. Next you simply create your page.html layout file in the _layouts directory.
Using a Github pages theme
If you want to use a Github theme, you can download the theme and put the files in the root. You can achieve the same by just adding this sinlge line to your _config.yml:
theme: jekyll-theme-hacker
The theme name here is 'jekyll-theme-hacker'. Optionally, if you'd like to preview your site on your computer, add the following to your site's Gemfile:
gem "github-pages", group: :jekyll_plugins
Source: https://github.com/pages-themes/hacker#usage
If you have a _layouts directory containing files with the same name as the new theme layout files, they will have precedence over the theme files.
This is the way Jekyll makes it possible to customize themes.
In this case remove the _layouts directory and Github pages will use the desired theme.

Keeping GH homepage in sync with README.md

While creating GitHub Pages for my project I was suggested to import existing README.md as the project's homepage. Later, I merged gh-pages with master and ended up with both index.html and README.md.
The "problem" is that the updates to README.md won't affect index.html. Is there any simple way to keep them in sync? Preferably with zero Jekyll knowledge...
Here's what I came up with, in case someone is interested.
Typically I write HTML using Jade preprocessor, and luckily it does support GitHub Flavored Markdown which is the language README.md is written in. So my steps where as following:
Translate index.html generated by GH Pages to Jade. I used online html2jade tool;
Save the output to index.jade;
Locate section block in the resulting markup in index.jade and replace its entire content with:
section
include:md README.md
Run jade index.jade which produces new, automatically generated index.html;
Commit both files to gh-pages.
See example in this commit on GitHub.

Using Github pages with Jekyll in a subdirectory

I recently wanted to publish my Jekyll site on Github pages, but it seems that putting everything in a subdirectory is giving some issues, even after I change the source to the correct directory.
My structure looks like this:
- site
- src (contains all Jekyll stuff)
- README.md
- GruntFile.js
- ...
Locally my site builds perfectly and when I go to http://localhost:4040 I can see it just nicely, but when I commit this to my Github and visit username.github.io I get a 404, if I go to username.github.io/src I can see part of my site, however all {% include %} are ignored.
In my _config.yml I updated the source: source: ./src, but that doesn't seem to help.
Is there a way to make Github Pages handle subdirectories properly? Basically I want to tell it that my Jekyll site is inside /src, and I want the url to just be username.github.io instead of username.github.io/src
I know i can use the pages branch and commit to there, but I would prefer if it could happen automaticly.
If it helps anyone, I attempted to run Jekyll on GH Pages from a subdir (and modified source) and was banging my head against the wall over these errors:
A file was included in subdir/index.html that is a symlink or does not exist in your _includes directory. For more information, see https://help.github.com/articles/page-build-failed-file-is-a-symlink.
After much searching on this, the definitive answer was right there in the docs:
Configuration Overrides
We override the following _config.yml values, which you are unable to
configure:
safe: true
lsi: false
source: your top-level directory
Keep in mind that if you change the source setting, your pages may not
build correctly. GitHub Pages only considers source files in the
top-level directory of a repository.
I contact Github support and they gave me 2 solutions.
Move all my Jekyll source files to my top-lever directory.
Use a different branch and update it manually each time.