The next thing that we can do is we can
actually deploy this website to GitHub pages. So if we head over to our
settings and we scroll down and we see GitHub pages. Once there we can see if we
click on source this will allow us to enable GitHub pages. We need to specify
what branch we want – we want the master branch. Again we’re not really concerned about what this is – the master branch is the
main branch inside of your GitHub repository and other people can create
new branches and merge code. So this will give us a URL. It’s okay that we get a 404
at the moment because the website usually takes a couple of minutes to get
fully published. We do have a bit of an issue here though. We don’t
know which file we should be set as the default page to open the site on. So what we
usually do for that is we create a file called index.html. So what we’ll do here
is we’ll rename the stream-one file to index.html. Servers usually know that
any file called index.html is the default or the first page to load and
render. So if we go ahead and do git status now we can see that as far as
git is concerned the stream-one.html file has been deleted. We’ll do an rm
command removes out on stem was to get to remove that. Then we’ll do a git add index.html file. Once we’ve
done that we’ll go ahead and write our commit so we’ll just say git commit -m
‘rename stream-one.html to index.html’. Go
ahead and enter. Then go ahead and do a git push and I’ll provide my username
and password. Remember here we won’t see the password being displayed.
So that command will push the code. Now if we go back to settings then
we’ll be able to find the URL for our github pages site. So we can see now that
our website has been published. So if I go ahead and click on this link here it will open up
our website for us. Unfortunately one thing that didn’t happen was that even though I renamed the file I didn’t update the links so instead of
the links in the navigation pointing to stream-one.html we need to
update them to point to index.html. So I’ll just update that now. I’ll open up the stream-three.html file and I’ll change that text there to say index.html in the
href for our anchor tag and I’ll do the same in the stream-two.html file. There we go –
so now I’m going to go ahead and run git status and I can see that the
stream-two.html and stream-three.html files have been modified. If I do git add . all of
those will be added to the staging area. I’ll commit this with a message of
update history at ref 2.2 index.html. So I can go ahead and do a git push. Once
again I’ll enter in my credentials so my username followed by my password and
there we go the code is pushed. So now I just need to go
back to the stream-three page. I’ll go to my index page. If I go to stream-two and stream-three and click on stream-one then I still get the issue because the browser
has stored reference to it. So what I need to do is I need to go back
to my stream-three page and do a page-refresh and now all my links work and bring me
where I need to go.

Leave a Reply

Your email address will not be published. Required fields are marked *