My github pages is not loading index.html as a default - html

My problem is simply when I go to username.github.io it takes me to another page in my repo rather than index.html however, when I go to https://username.github.io/index.html it works correctly. I would rather have username.github.io point directly to index.html.
Note: My problem is NOT like the problem here
My problem is also NOT like the problem here as "waiting" doesn't fix it, nor do any of the other solutions given
Edit: It is consistent, rather than going to index.html it takes me to a page where I'm hosting a game I made, which also is in a whole other directory and is not even titled index.html.

Related

Github pages not recognizing CSS

This is my first time trying to use Github pages. I am able to to get the index.html to work, but the style will not. I am serving from the master branch docs/ folder.
Everything works fine when I run it on my local host. Any ideas?
File tree
Stylesheet
Tried changing my static and templated folder names to 'docs' and 'css' as I thought Github looks in specific folders for HTML and CSS files. Also looked to make sure my href was pointing to the right place. I'm new to this, so I may have made a mistake.
EDIT: I am using Flask, which may be causing the issue, website is still static. IDK if Flask and static contradictory.
Thanks

Why aren't my anchor tags functioning on GitHub?

I assume that when I upload a repository, only one file is displayed on the site, and the other files are just sitting there in the folder, waiting to be accessed by the anchor tag. Instead, when I try to click one of the anchor tags hosted on GitHub, it leads to a 404 error. Do I have to make a repository for EACH of my .html files even if they're in the same folder? This sounds very insufficient, I believe there is another way to go about this that I don't know of.
On my main index.html file, I included anchor tags that direct the user to another section of the site with this:
Dashboard
I can already see why this doesn't work but I don't know how to fix it. So I just ended up with this:
Dashboard
I added basic-website because that was the name of my repository. Sadly, it didn't work. Any solutions?
Assuming you mean GitHub Pages and not GitHub.
If your repo is named basic-website then the URL to the top level of the repo will be https://example.github.io/basic-website/.
This means that dashboard.html will have the URL https://example.github.io/basic-website/dashboard.html.
If you link from https://example.github.io/basic-website/ to /dashboard.html then you get https://example.github.io/dashboard.html. Which is wrong. basic-website is missing.
If you link from https://example.github.io/basic-website/ to basic-website/dashboard.html then you get https://example.github.io/basic-website/dashboard.html. Which is wrong. basic-website is there too many times.
Just link to dashboard.html.
Don't put a / to go up to the root of the site.
Don't put a directory to go down into when you are already in that directory.

Html directory link not working if the directory is not from the beginning

My problem is that I have a bunch of HTML files but in simple I have public_html/pages folder + index.html/under pages folder a dmca.html is located.
So when I want to locate the file using href = "pages/dmca.html" it doesn't work and on another side when I use "../../public_html/pages/dmca.html" from the beginning it works is it normal or something wrong so I can only use the simple way as I have mentioned above(the link)
You have to look where is the .html file located on the hierarchy. If you are in dmca.html and you have a href on that page to second.html, you will need to jump backwards to the pages directory, and then go to the file: ../second.html
Now, if you are in index.html, and you have a href linking to dmca.html, you will need to hop back one level, enter pages directory, and choose the .html file. So it would be like this: ../pages/dmca.html
-public_html
|
|--index.html
|--pages
|--dmca.html
|--second.html
If I have not explained myself correctly, or I've understood the question wrong, please tell me.
What is happening, if I understand the problem properly, is that you are in index.html, and you want to href dmca.html, but the route you use pages/dmca.html, doesn't work, but if you use ../../public_html/pages/dmca.html, then, it does work. And I guess you are asking why is this happening.
Well, what happens when you use pages/dmca.html is that you are saying: search for a subdirectory called 'pages' and go to the file inside it called dmca.html. This would be correct if you had this hierarchy:
-public_html
|
|--index.html
|--pages
|--dmca.html
|--second.html
But index.html is a file, so it can't contain subdirectories. That's why you have to go one level up the hierarchy, and then, once you are in public_html/ you can choose to load index.html or go to the subdirectory public_html/pages and choose a file from it.
Right now I'm working on my web page, and... rethinking about it, I have to say that you were right, I mean, what you were doing was supposed to work.
Look at my directories. I have a htdocs folder, inside it I have some .png, index.html, and a folder called "prova", inside the folder "prova" I have index2. You can see that it is the same case as yours. I have an href on index.html that says href="prova/index2.html" and it works for me. Actually what I've said to you on the morning is wrong. I'm sorry :/
Because if I write ../prova/inedx2.html what happens is that the folder "htdocs" is removed from the URL. Remaining as: "PortàtilHP_antic_pare/prova/index2.html" You can see that the folder between "PortàtilHP_antic_pare" and "prova", which should be "htdocs", has disappeared.
So now I'm wondering how my answer has been useful for you. I guess I have understand it wrong, and somehow, my answer has made you change something that somehow has worked.

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/

Do I need slashes before links?

When I code my website, on my local computer i can use
blablabla.
However, I also can see this type of thing on other places as
blablabla.
I am not sure what I will need when my site goes live. If I try to do this on my local computer, it doesn't understand it. My question is, if I post my site up like this, will it work?
Ok, if I have all of the files of my site in the root directory that the main index.html file is located in, will it work when it is being hosted?
If you do not use a slash, the link will point to index.html in the same folder as the page the link is on.
For example, if you have a link to index.html on the page www.example.com/page2.html then the link will take you to www.example.com/index.html. If you include a slash, it will do the same thing.
However, if the link is in a page in a subfolder, like www.example.com/projects/page2.html, then the first link will take you to www.example.com/projects/index.html while the second link will still take you to www.example.com/index.html.
The slash denotes the "web root."
Note that these are still considered "relative" links: they refer to a resource on the same server, regardless of the server's name. If your domain name changes or you upload it to another server, relative links will still work provided they have the same folder structure.