Github Pages site not detecting index.html [closed] - html

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I created a GitHub pages repository. For some reason when I name it
https://[username].github.io, it doesn't work, but it works when I name it https://[username].github.io/index.html.
Why?

It got fixed automatically. I just had to wait for a while for the settings to take effect.

Pushing a second commit fixed this for me.
Seeing other answers where changes fix this, my guess is that you need to trigger a few of deployments to get it to work.
Every push will trigger a new deployment. You can track deployments at https://github.com/username/username.github.io/deployments.

If you don't use Jekyll, the workaround is to place a file named .nojekyll in the root directory.

My index.html had the following DOCTYPE setting:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" http://www.w3.org/TR/html4/strict.dtd">
Changing it to:
<!DOCTYPE html>
Fixed the issue for me.

Faced this today (Oct-06-2019)
I double-checked every setting, all of them, didn't fix issue for me unless I changed some content in my index.html file. I also added some files to the repo to make it "alive" but in vain.
So, In my case, I opened up my index.html right in the browser, clicked on edit and added a single word, commit to master branch, refreshed and it took less than 5 seconds and it was up again.
P.S. I tried pretty much all solutions given anywhere nothing else worked for me.

I also encountered the same problem today (05/28/2020). Suppose that you have done everything right (instructions in https://pages.github.com/), you should have a repo named username.github.io and index.html set up.
What worked for me was that I chose a Jekyll theme. First, go to Settings of the repo. In GitHub Pages section, look for Theme Chooser then click on Choose a Theme. It will redirect you to a GitHub page that has multiple themes that you can choose from. Choose a theme that you like then click Select Theme. After doing these steps, I refreshed my username.github.io and the page worked correctly.

This happened to me and as soon as I did another commit the issue resolved itself. I just added a space to the index.html file in my dist folder, committed and pushed that change to my gh-pages branch and BAM! Now I can access username.github.io/repository/index.html by just going to username.github.io/repository.

I had this exact same problem. If you try the link found in the designated repo > Settings > GitHub Pages after an hour after posting all your code, the GitHub page will work.

Similar problem. I had to create random change to my html, go through the git add/commit/push process. That fixed it for me! Now I can access to my page without having to add .html at the end of the url.

If you are not using Jekyll, delete the _config.yml file from the repository. This fixed the issue for me.
You may also try to push the local repository again.

Pretty late to the party but here is how I fixed it for myself today.
Go to settings for your repository: You can find Settings tab in your repo page.
Scroll down to GitHub Pages section on the settings page.
In the panel, you will have a Source info that states : 'Your GitHub Pages site is currently being built from the gh-pages branch'.
However, in my cases, all code was in master branch. So I selected the branch from dropdown as master and in merely a minute, it was published successfully.

I had a similar problem for the private repository. My Git project contained index.html in root but the page did not display under http(s)://<username>.github.io/<projectname> path.
The solution for either way (public repository or not) is in enabling GitHub pages in project repository settings under 'GitHub pages'.
However, be aware that enabling pages under private repository make the .html files public.

I encountered the same issue on deploying automatically a bookdown page from the gh-pages branch with Github Actions:
When I tried to access the url proposed by Github in the GitHub Pages section of the repository settings
https://<username>.github.io/<reponame>/
I got a Error404: Page not found response.
However, manually adding "index.html" at the end of the url displayed the page.
https://<username>.github.io/<reponame>/index.html
Adding manually a CNAME file with the following content to the gh-pages branch solved the issue permanently:
https://<username>.github.io/<reponame>/index.html
It's more a workaround though...
EDIT:
Adding a CMAKE file solved the problem only temporarily as it was removed upon invoking the gh actions workflow.
Either:
i) change gh-actions workflow to create the CMAKE file at the end (still a workaround...)
or how I could solve it in the specific case of using bookdown:
ii) in the YAML header of the index.Rmd file, I added
url: "https://<username>.github.io/<reponame>/"

There is also a more subtle problem which causes this issue.
If you are using image files with huge sizes in the index.html, this problem occurs.
Reducing the size of the images being loaded solved this problem for me.

In Settings>Github Pages, make sure that the branch selected there is the same as the one you are working with. I had the same problem and the branch was master instead of main so I changed it and it is fixed now.

Related

Website built with jekyll displays differently from local when push the changes to github

I am using a jekyll template to build my website. I made all the changes locally and it runs all smoothly. However, when I push all the changes to github and open the github.io link, the front page is displayed differently. I am wondering what the possible problem is?
The difference is specifically the way that the front page of the website is displayed. Locally, it is supposed to show all the posts with "Page 1 out of 1". But on the github host it does not.
This is the github repository: https://github.com/BiostatisticsPodcast/BiostatisticsPodcast.github.io
Thank you guys in advance!
I tried to edit the config.yml file from scratch and it still does not show. I suspect the problem is in index.html but I cannot figure it out. :(
You publish your page from a branch. Under the hood, this uses the jekyll-build-pages action, with fixed versions for Jekyll and its dependencies. On top of that, the number of plugins is limited to a short list, which does not include the jekyll-archives plugin your theme requires, as the corresponding line in the config file indicates:
- jekyll-archives # Sorry, not GitHub pages friendly!
The solution is to switch to publishing with a GitHub Actions workflow. You can use the Jekyll starter workflow; follow the instructions here to set it up.

Github Pages - trouble rendering a Page with Jekyll

Whilst using Github Pages I can't get Jekyll to render a contact page.
I am using the following template: https://github.com/antonostrovsky/tale
If I clone the template into a local repo and run bundle exec jekyll serve I get a page with a Contact link that I can successfully follow. The generated _site folder contains a subfolder 'contact' with index.html within it.
I then create an empty repository (https://github.com/antonostrovsky/test_site) at Github and specify this template in _config.yml:
remote_theme: antonostrovsky/tale
The template is successfully rendered, I can see the template on the index page (https://antonostrovsky.github.io/test_site/), and the Contact link leads to nowhere, resulting in "Not Found" error.
Can anyone please help me understand how I can troubleshoot this? Does Jekyll have any debug output that could be placed on a github page?
Does anyone know what could be going wrong?
Thank you in advance
I made a diff between your repo and the template repo and noticed that at some stage you deleted the baseurl property in the _config.yml file.
Forking your repo and re-adding baseurl: "/tale" to the _config.yml file fixes the contact page link for me.
UPDATE:
While the above gets the page working as a fork it doesn't work as a remote template which is what the asker needs.
The test_site has the theme and it builds, however it has no content. There are no pages in test_site repo.
If you copy your contact.md page from the theme template repo into pages/contact.md in the test site repo and then rebuild then your link should now work.
Note: Neither the file nor folder can start with an _ in the test-site repo because it will get skipped over by jekyll.
Tip: Open the dev console and disable page caching then reload to see your changes on github faster. It also helps to add change some page content so that you know you're seeing the most recent version.
To add to the accepted answer and explain this strange behaviour. Pages from the remote theme are NOT included by design:
Custom theme files can be placed in:
assets/allposts.html
with the front matter
---
permalink: allposts.html
---
which results in the
_site/allposts.html
file being generated.
Source: https://github.com/benbalter/jekyll-remote-theme/issues/64

How to keep changes after saving in Jekyll using VS Code

I am new to Jekyll and setting up my first blog site. I opened the newly generated Jekyll folder in VS Code and made changes to the index.html file, saved it, and then viewed it on localhost:4000. I made changes to I see the small changes at first, but then a few minutes later the changes I made are gone, and the site looks as it did when I first generated it. I am not sure why this is happening. I have tried searching google and stack overflow for an answer but have not found anything that can tell me why my saved changes are not staying and how I can get them to stay.
The contents of the _site folder are regenerated automatically every time you make changes elsewhere.
Never make changes to contents in _site manually — it's pointless
To customize your site, instead make changes to files outside the _site directory.
Read the entire page at the following link to get a good grasp at customizing your theme's templates: https://jekyllrb.com/docs/themes/

Jekyll theme is working on local, but not working on remote

I forked this theme and created a simple pages, modified some css files - setting fonts for specific tags or disable italic on subheadings.
It works like a charm in local. But when I commit the files and push the repo, It shows contents but the design things are gone! I mean, It shows only html contents.
This is the page on local environment:
And this is the page on the remote server..?
I can use basic tags and change some properties of tags in CSS, but I don't know about more details.. Could you please give me some kinds of guide or how to fix this problem?
Edit -- Here is my git repository:
https://github.com/soldier4443/soldier4443.github.io
In _config.yml, remove baseurl: "/blog" to read baseurl: "".
FYI- if your theme is working locally but not working remotely(OP didn't have an issue with this, though this was my mistake), make sure that the remote repository is named .github.io
More info. from the official documentation: "GitHub Pages are initially configured to live under the username.github.io subdomain, which is why repositories must be named this way even if a custom domain is being used."
source: https://jekyllrb.com/docs/github-pages/

Why is just the HTML showing after I push my changes from Jekyll to Github Pages?

I am creating a blog on Jekyll for the first time and I am at the point where I'm trying to deploy what I have so far to github pages. When I serve the site and view it locally, it looks fine - so I thought that all I had to do was push all of the files to a gh-pages branch. Now that I have done this, all that is showing is the HTML.
To troubleshoot, I downloaded just the template files and pushed those to a Github page to see if the issue had to do with how I was editing the CSS, but when I did that I got the same results.
I came across an article that was specifically about how to use github pages to store a jekyll site, and it said to remove the slash before the css folder in the linked stylesheets on the HTML if your page isn't styled correctly. After reading that I thought that the slash was for sure the issue, but after removing the slash... I got the same result.
I have been trying for hours and I feel like its probably something very simple(such as the slash).
Here is the repo:
https://github.com/pacalabre/blog-site/tree/gh-pages
Here is the output:
http://pacalabre.github.io/blog-site/
Thank you in advance for any answers!
You need to add/edit:
baseurl: /blog-site
to the config file. Note there is no trailing slash. 'blog-site' is the name of your project, the project name becomes a sub directory that serves your site. Without the baseurl setting, your relative urls are trying to fetch things from http://pacalabre.github.io/ when they are really at http://pacalabre.github.io/blog-site/.
GH is serving your site as a subfolder to the domain and your references are not taking that into account.
Once you add the baseurl setting, you then need to add {{site.baseurl}} in front of your assets like images, css and js.
Also, once you do the baseurl setting, when you serve locally it will not be quite correct, you will need to add the /blog-site to the end of the localhost url for it to work properly.
You also should try using the dev tools inspector in Chrome to help you troubleshoot, it will clearly tell you right now that it cannot load all your js files or images, and it will show where it is trying to load them from.
Look, there's something wrong with your site/repo.
I didn't find your _config.yml at the site root ( gh-pages branch). It should be there.
There's a binary file there (probably Mac's file if I'm not mistaken). It shouldn't be there.
There are both Jekyll's folders (_posts, _drafts, _layouts, etc) and _site folder there. You need to choose. Or you upload the _site content (not the folder itself) or you upload the Jekyll project. Usually you upload just Jekyll folders and GH build the site for you, unless you use some plugins which are not allowed by GitHub. In this case, you upload just the _site content, which is the compiled site (html, CSS, js only).
On the previous answer, you were instructed to add a baseurl to your site configuration. It's the best approach, but if your template uses just url and doesn't even mention baseurl, the best way is adding the project name to the end of the url, not searching for every link to call {{ site.baseurl }} via liquid. So, instead of giving yourself all this trouble, better do like that in your _config.yml:
url: http://username.github.io/projectname
If you indeed go for setting up the baseurl, you can view your site locally via localhost:4000 by adding this flag when serving Jekyll: --baseurl "". So, jekyll serve --watch --baseurl "". This means like "Jekyll, ignore the baseurl set in the config". Got it?
Serving Jekyll with bundler is the right way to do that, specially when deploying to GH Pages. But this is another story, I can add a comment later if you're interested.
Suggestions. Read a little more about how Jekyll works. Also look for .gitignore so you won't upload to GH anything unnecessary (like that binary file).
After that, if your site doesn't build or display correctly, let me know and I'll help you out if you want.
Hope to have helped!