Ready to dive into the world of web development from your own domain? Welcome to the beginner's guide on iyhub.io. Today, we're going to simplify the process of creating your very own website using GitHub Pages. So, let's roll up our sleeves and get started!

First things first, what are GitHub Pages? In a nutshell, GitHub Pages is a static site hosting service that takes plain text files and turns them into web pages. It's a perfect platform for beginners, allowing you to create a professional online presence for free. Let's break down the process into manageable steps.

Setting Up Your GitHub Pages Repository
First, you need to create a new repository on GitHub that will host your website. That's right, your website will live in its very own GitHub repository.

To get started, log in to your GitHub account and click on the '+' icon in the top-right corner. Select 'New repository' and name it in the following format: yourusername.github.io. This is a requirement for GitHub Pages to recognize your repository as a website. Click 'Create repository' and you're ready to move on to the next step.
Understanding Your Repository Structure

Your new repository should now be empty, with a README.md file and nothing else. This is where your website's content will live. The base URL for your website will be http://yourusername.github.io.
Here's a simple structure you can follow for your website: ``` yourusername.github.io β ββ index.html ββ about.md ββ ... ``` By default, when you navigate to your domain (http://yourusername.github.io), GitHub Pages will look for an 'index.html' file and display its content.
Initializing Your GitHub Pages

Next, let's initialize Git and GitHub Pages in your repository. In your terminal, navigate to your repository folder and run the following commands:
git init
git remote add origin https://github.com/yourusername/yourusername.github.io.git
git branch -M main
git checkout -b main
Then, create a simple 'index.html' file with the following content and commit your changes:
<!DOCTYPE html>
<html>
<head>
<title>My GitHub Pages</title>
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>
Now, push your changes to GitHub using the following command:

git push -u origin main
After a few seconds, your website should be live at http://yourusername.github.io. Isn't that exciting?
Adding More Content to Your Website


















Now that your 'index.html' file is live, let's learn how to add more content to your website.
Creating New Pages
Let's create an 'about.md' page. Add this file to your repository and commit your changes. To create a link to this new page, update your 'index.html' file to include the following line:
<a href="about.html">About</a>
Notice that we've linked to 'about.html' instead of 'about.md'. This is because GitHub Pages converts '.md' files to '.html' when it generates your website. So, you need to refer to them as '.html' in your links.
Adding Markdown Support
One of the great features of GitHub Pages is its built-in support for Markdown. This means you can write your content in plain text with simple syntax to create headings, lists, and more. Let's update our 'about.md' file with some content:
# About Me
## I'm a web developer
lΓΆrem **ipsum** dolor **sit** amet.
* coffee
* code
* repeat
When you refresh your website, you'll see that GitHub Pages has converted this Markdown into the corresponding HTML. Isn't that neat?
Customizing Your Website's Looks
Ready to give your website a personal touch? Let's add a custom theme. In your repository, create a new folder named 'stylesheets' and inside it, create a file named 'main.css'. Add the following CSS to give your website a basic layout and style:
body {
font-family: Arial, sans-serif;
margin: 2em;
}
h1, h2 {
color: #333;
}
Then, update your 'index.html' to include this new stylesheet:
<link rel="stylesheet" href="stylesheets/main.css">
Now, push your changes and refresh your website. You should see your new CSS in action!
Building Your Website Further
Now that you have the basics down, the possibilities are endless. You can add JavaScript, use a static site generator like Jekyll, or even host a blog using GitHub Pages.
Adding JavaScript
Let's add a simple JavaScript file to make your website interactive. In your repository, create a new folder named 'js' and inside it, create a file named 'script.js'. Add the following code:
alert('Hello, World!');
Then, update your 'index.html' to include this new JavaScript file:
<script src="js/script.js"></script>
Finally, push your changes and open your website in an incognito or private browsing window. You should see a pop-up alert when the page loads.
Using a Static Site Generator
Static site generators like Jekyll allow you to create dynamic, content-driven websites using markdown files. To use Jekyll with GitHub Pages, you'll need to update your repository's settings and add a few files. For a detailed guide, check out the official Jekyll documentation: https://jekyllrb.com/docs/github-pages/
Hosting a Blog
Another popular use case for GitHub Pages is hosting a blog. To get started, check out this guide on creating a blog using GitHub Pages and Jekyll: https://guides.github.com/features/mastering-jekyll/
And there you have it! You've just created your first website using GitHub Pages. From here, the sky's the limit. Happy coding, and remember, the best way to learn is by doing. Good luck!