Open SH20RAJ opened 7 months ago
Waiting for your response with the solution....
Thank you for pointing out this problem. I didn't realized this before.
I have searched but it seems that for GitHub Pages it's is not possible to change the status code...
With a custom server it should be possible to server as 200 for all not-found requests: https://github.com/yusanshi/emgithub?tab=readme-ov-file#use-your-own-web-server
Also, if we use other hosting service other than GitHub Pages, like Vercel and Cloudflare, it may be possible to do this trick. However, that's gonna make things messy...
Basically, the 404 mainly occurs in two places:
For the main page, I have added index.html
which is a symbolic link to 404.html
: https://github.com/yusanshi/emgithub/commit/8864988d4f6f1174d8b9aac2bc2735fcd4a34745. Now requesting the main page would result in a 200, so hopefully the site can be later included by Google search.
For the embedding page, I still have no clean methods with GitHub Pages. But I believe 200 for the main page would be enough.
What do you think?
I think for ranking your site (emgithub) on Google. You should try google search console + analytics. ( because this gem deserves to be popular ) 2 Years before I found this repo and cloned it here The main thing is that I learned from your repo (trick/technique) that how a 404.html can handle all other requests and we can do rest of the things using JavaScript (Parse URL and extract Parameters)
And I made ArticlePlanet Taking Inspiration from dev.to for Markdown Article. I almost completed the website here without database I was using GitHub Gists for Article Hosting and also getting backlink from there for good SEO. Here See Article
But My Articles wasn't ranking I thought it's because I'm loading content dynamically using GitHub API. But I saw search console is blocking to rank it, then I understood that's it's because 404. That was the story part. Now whats the solution. For You ( You don't have to rank other other URLs other than Home Page URL )
But for me I have to rank all pages of the ArticlePlanet.
See This URL is being ranked. https://articleplanet.github.io/post.html?id=73486096e84d29a730fb3a9a827ee893 (200 Response ) but https://articleplanet.github.io/posts/73486096e84d29a730fb3a9a827ee893 ( 404 Response ) Despite Both Links works same. HTML same (little differ)
Now, If you want then you may show some solution to me also maybe by using the second solution approach I shown you i.e.
Or Use another approach to built custom and clean URLs without having it.... Knowing (you - I have searched but it seems that for GitHub Pages it's is not possible to change the status code...)
means can we build custom URLs without using this technique o "GitHub Pages". (i.e. jekyll, cofigyml, workflow, actions, etc)
and if it's not possible the you said about the tricks for other hosting.
Also, if we use other hosting service other than GitHub Pages, like Vercel and Cloudflare, it may be possible to do this trick. However, that's gonna make things messy...
You can also show some way for that :)
if you want waiting for your response (eagerly)
. . . .
Sorry but I have no experience with Vercel or Cloudflare, so I don't know how to do the trick with them :disappointed:
The server is responding the page as 404
because you are serving it from 404.html of GitHub Pages and I know it doesn't create a big impact on this type of website but for making a content site like blogging website google doesn't index the 404 pages and that's why your website https://emgithub.com/ is not on google search results.
Solution Approach