I deployed a gatsby blog I made to github pages. The first page links to a blog article. Nothing shows up when the link is clicked. But if I type the url in manually (Same url that is linked) I see the page for half a second before it dissapears to a blank page.
Helpful information
Everything in the network tab is status code 200
The HTML is returned in the get request, it is visible in the response
head tag is on the page correctly, body tag is missing the html
No console errors
Works perfectly on development server (localhost)
Domain is hosted with domain.com
Using createpage gatsby plugin to generate article page
It works when I deploy on netlify to a random url so maybe something to do with my domain or the gh-pages deployment
After looking at your GitHub code, I think you have a problem here: (Wrong URL: /blog/blog/why-gatsby), also your master code does not match code with the gh-pages (I know it's generated files from gatsby build but other stuff). Also, why are you creating a static query in the index.js component? You can do that with a regular page query.
Your gatsby site starts from https://www.ragith.com/blog/ and that's why you have that kind of a problem. When gatsby look into pages, there's only blog.js inside of it.
I.E:
pages/blog.js
Link problem
<a class="article-card-link" href="/blog/blog/why-gatsby"><section><article><h2 class="article-title">Why Gatsby js ?</h2><p class="article-date">May 09, 2020</p><p class="article-excerpt">In a world with so many JavaScript frameworks such as React, Vue, heck even Next, why Gatsby? The short answer is, none of those frameworks are the target market of Gatsby. Gatsby is a static website generator. Great! Wait, who cares? Well a lot of my clients and so will yours…</p>READ MORE</article></section></a>
Related
I tried to build up a Jekyll blog website using GitHub pages. I could check the homepage, but the subpages (about & blogposts) showed 404.
To find out where the problem is, I opened a new repo. And I set up the basic things of a Jekyll site using jekyll new . locally and uploaded them to the Github repo. I did not change anything after this step.
And then, I used jekyll serve to run the local test, and everything went well. The layout looked nice and I could check the first blog "Welcome to Jekyll!"(built by default).
However, when I used the link of GitHub Pages to check, the layout of the homepage looked quite different, and I could not check the default blogpost "Welcome to Jekyll!", which showed me 404.
How can I fix it?
This is my repo: https://github.com/jl-xie-kcl/blog20211122
(you can check the screenshots in issue 2 https://github.com/jl-xie-kcl/blog20211122/issues/2)
Those pages do work, your links are just incorrect because your blog is not at the root of your domain — and this goes the same for the style and images not working, by the way:
The link to your about page: https://jl-xie-kcl.github.io/blog20211122/about
The link to your blog post: https://jl-xie-kcl.github.io/blog20211122/jekyll/update/2021/11/22/welcome-to-jekyll.html
In order to fix this, you will have to change the baseurl value in your _config.yml to:
baseurl: "/blog20211122"
As stated by the comment on this configuration line:
baseurl: "" # the subpath of your site, e.g. /blog
I created a Flutter web app and published it via my personal github.io repository site. This root site loads and works as expected.
I also created a simple HTML/CSS/JavaScript website and pushed it to a respository on my github. I published that site, as well, and it loads as expected. (From the repository home page I went to Settings, Pages, and enabled the respository as a GitHub Pages site by selecting its master branch for the Source setting.)
In other words, I can publish a flutter web app to GitHub Pages & I can publish more than one web site to GitHub Pages.
But when I try to publish a second Flutter web app, following the same procedures as for the simple HTML site, and even get the message from GitHub (with a green check mark) telling me my site's published, all that's displayed is my root github.io site. When I enter the URL I see the correct page title briefly flicker, but then root site immediately loads. (I have more or less the same issue as described in this post.)
If you need to host a Flutter web app at a non-root location, you need to follow the instructions for doing so:
Update the <base href="/"> tag in web/index.html to the path where
your app is hosted. For example, to host your Flutter app at
myapp.dev/flutter_app, change this tag to <base href="/flutter_app/">.
You need to change your base to <base href="/repo_name">. If you did not already have a base tag, add it.
You might also be able to just remove the base tag if you had it set to the default of <base href="/">.
I tried to setup two repository github pages. Just wondering why one works and the other doesn't.
Works - https://ngaisteve1.github.io/calculator/
Doesn't Work - https://ngaisteve1.github.io/BlackJackJS/
Second question is, is it possible for my to deploy my html with Javascript in GitHub pages or is it GitHub pages is only deploy html page?
Both links work now. GitHub Pages might take a moment to deploy your most recent changes.
You can host any static content, including client-side JavaScript (GitHub Pages will not run any code for you on its back end).
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.
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.