Can not host a webpage on Github - github

I have a javascript and html snake game and I want to host it on github I do All the steps and make a gh-pages But I get this error 404 File not found ?when I search Username.github.io/repository-name
Any idea why and how I can fix it? Should I wait for github email After I do the commands??

Most web servers have a "default" page, e.g. index.html, that will be shown when the user doesn't request a particular page. GitHub Pages is no different.
Your repository contains a single file called snakeGame.html, which works just fine if you request it. Unfortunately, GitHub Pages doesn't know that this page should be shown by default. As far as it knows that file has no special meaning.
To get your page to show up at http://peggykh.github.io/Snake/ instead of http://peggykh.github.io/Snake/snakeGame.html, you should rename your file to index.html.

Related

Github Pages site visit 404

Problem
I have deployed the website through github page, custom domain, and the articles are accessible normally. But copy and paste the article address, open a new page in the browser, paste the article address, the page 404. I can confirm through the text comparison tool that they have exactly the same link address, after accessing the home page through the custom domain, click on the article can be accessed, directly accessing the article (not accessing the index.html home page of the custom domain), will 404. this 404 page is not This 404 page is not the 404 page of the theme, but the 404 page of the github page.
The steps for reproduction are as follows:
visit guowei-gong.github.com
click on any article
copy the address of the article (either directly from the address bar or by copying the article address at the end of the article)
Open a new window in your browser
Paste the address of the article and reproduce it
I tried to find out if anyone else was experiencing the same thing as me and came across one of the 2015 discussions (Fargo discussion) where they thought it had something to do with the repository of the github page, if that repository is your username then it always resolves the main branch and the other repositories resolve the gh-pages branch. I'm currently using a repository named after my username before I cry, and I've changed the Branch under Repositories -> Settings -> Pages, as shown below. Could this be the cause of this problem? I'd like to try deploying directly to the main branch as a next step.
Supplementary
Now I've tried deploying in the main branch and it's been 15 hours and still the same problem!
I cancelled the Github action workflow deployment and pushed the locally generated static page directly, and I was able to make sure that the static page looks fine locally. Here is the github repo address.

Can I embed a google document in Github's readme.md using markdown?

I am trying to embed a google docs in Github's readme.md using markdown. Is this possible?
I have done the following:
Published the document to web and copied the iframe code.
Pasted the code in markdown. Nothing happens.
Pasted the code between and nothing happens.
Any suggestions?
This isn't possible. When GitHub renders a README or other text document on the site, it gets passed through a filter to sanitize it and remove anything potentially malicious, including JavaScript and iframes. That's because these documents are rendered in the context of the github.com domain, and any malicious code could steal user credentials or otherwise create privacy or security problems.
Note that even if you could bypass the sanitizer, GitHub sends a Content-Security-Policy header that restricts JavaScript to a single, specific domain and rejects all frames, so your browser would not render such content, and it would use the report URI to send a notification to GitHub that a violation had been detected.
You could save the Google Doc as Markdown, AsciiDoc, or HTML and place it in your repository for people to use if you want it to be visible on GitHub.

Using GitHub Pages to serve files (i.e. zip)

I have setup GitHub pages and my site is working fine, but when navigating to the zip file at the site (i.e. mysite.com/example.zip), I get 404 error page. The files are in the repository and it seems that for some files it works as I can access PDF file just fine (i.e. mysite.com/myfile.pdf). Couldn't find any mention that GitHub Pages are blocking this, but seems like it, or am I missing something? Is there a list of files which ones are served and which not?

GitHub pages and jekyll deploy not working properly

My jekyll blog is running ok in my pc but when I open it from my gh repository it's broken. Here's a screen of that
If I click on one of the links, that next page throws 404. Needless to say, I followed the steps from the gh site in order to configure it properly.
baseurl is set, the paths to css and images are correctly set using {{ site.baseurl }}. So locally the blog works fine, but still, on gh-pages it's not.
Code is here
Another piece of information. I have a master branch and a gh-pages branch, the one updated is gh-pages, master has old code, is it ok?
Any ideas please?
It works ! What you saw was an old version of your site.
Two possible explanations :
as #goyllo says : browser cache f5 or Ctrl+r can help.
Github pages is serving the old version and the new site generation is still pending.
In order to know if you last commit has been published it to go to https://github.com/goblind/modestoRimba/settings and to watch under GitHub Pages box.
If you see Your site is ready to be published at http://goblind.github.io/modestoRimba, your site generation is pending.
If you see Your site is published at http://goblind.github.io/modestoRimba, your site have been published with last commit.
It's working fine in my browser. I want to say one thing, GitHub pages cache your old resources(including HTML, CSS, JS, Images), in browser for better UX, For example, just disconnect your internet, and reload that page again, and it will be work fine, similarly if you visit another page, then it will not load your CSS, or javascript again from your website, they will load directly from browser cache. So you are getting this error because your browser use old cache resource, and it will update again in few hour, depending on cache time.
I want to say, if your blog working fine in localhost, then don't worry, it will be also work fine in github pages as well, otherwise github will send you notice in your email regarding page build fail.
in your _config.yml baseurl: /modestorimba R should be uppercase.

How can I publish old html commits in my gh-pages branch online?

I'm writing a blog post and want my readers to see several old commits (of html) in my gh-pages branch.
In my blog post, I want to say, here's how the code looked in the browser, at this commit.
For example, this is one of the old commits that I want to show: as an html page that someone could view in their browser as the HTML would look in a browser; I don't want to just show them that raw page on github because the code on that old commit is broken and want the reader to see the error that the browser's console would give.
I'm thinking of something like: skorasaurus.github.io/reponame/commithash/index.html ?
Does this exist?
If you click on the "View" button of the index.html file listed on https://github.com/skorasaurus/dtparking/commit/945fae4e059fb12090a8dc22c6cd22e665ebeea2, you will get the exact reference for that file:
https://github.com/skorasaurus/dtparking/blob/945fae4e059fb12090a8dc22c6cd22e665ebeea2/index.html
You can then use the service from htmlpreview.github.io to visualize that specific version:
http://htmlpreview.github.io/?https://github.com/skorasaurus/dtparking/blob/945fae4e059fb12090a8dc22c6cd22e665ebeea2/index.html
(with the console of the browser including: Error: Map container is already initialized.)
See other alternatives at "Can I run HTML files directly from GitHub, instead of just viewing their source?".
You can then try and embed that rendered page in your gh-branch source. For instance (How to embed a “live” web page in WordPress blog posts)
<object data=http://www.example.com width=”650″ height=”500″>
<embed src=http://www.example.com width=”650″ height=”500″ />
</object>
(replace example.com with the full htmlpreview url above)