How can I host two Flutter web apps on GitHub pages? - flutter

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="/">.

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.

deployed page loads but does not show - built with gatsby

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>

There isn't a GitHub Pages site here

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).

Why isn't my github project going live?

I created a subbranch for gh-pages. I don't know why the page isn't getting created. I'm attaching the screen shot of the bash.
Even at the github page, when I hover over the tick mark, it says that github has successfully created the page.
Link to my github
To make a github pages site, you must follow the naming convention for your repository; in your case puneeth8994.github.io.
Also, the main html file should be called index.html.
The following is a great resource to get started on github pages:
https://24ways.org/2013/get-started-with-github-pages/

Can not host a webpage on 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.