TL;DR: If you make a repo called <your_github_username>.github.io
, GitHub will host your
site for free! Then it's as simple as adding an index.html
file to the repo and building on top of it.
<your_github_username>.github.io
(replace
<your_github_username>
with your actual GitHub username).
index.html
Fileindex.html
File:
index.html
.<!DOCTYPE html>
<html>
<head>
<title>My Portfolio</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
</style>
</head>
<body>
<h1>Welcome to My CS180 Portfolio!</h1>
<a href="./1/index.html">Project 1</a>
</body>
</html>
https://<your_github_username>.github.io
in your web browser.index.html
file displayed as your website.
Right now, if you copied the example HTML above, you'll notice the 'Project 1' URL returns 404 as it links
to a page that doesn't (yet) exist.
For each project, you should create a separate directory/subpage that you'll link to from the main page.
An example directory structure is below:
<your_github_username>.github.io/
├─index.html (main page)
├─1/
│ ├─index.html
│ └─media/
│ ├─img1.jpg
│ ├─ ⋮
│ └─imgN.jpg
└─2/
├─⋮
Each time you commit changes, GitHub Pages will update your site in up to 10 minutes. For this reason, we recommend cloning and editing locally so you can witness your modifications real-time and then push once satisfied.
<style>
tag in the
<head>
of your index.html
file.
style.css
file; if you wanted to re-use this styling
across projects pages, you'd place it in the root directory and import it absolutely with
<link rel="stylesheet" href="style.css">
in the <head>
tag.
<link rel="stylesheet" href="./style.css">
.
<img src="./media/img1.jpg">
We aren't going to be sticklers about the design of your site, but it should be easy to navigate and understand. You shouldn't bog the site with deliverable images that take up the whole page, for example.
Extras -- These are in no way required!<your_github_username>.github.io
page/repo, you could set up a
new repository named "cs180" and configure it to publish to
<your_github_username>.github.io/cs180
(tutorial,
starting step 4)