CodeBlanks Logo Icon CodeBlanks

What is Pages?

Learn to publish a static site with GitHub Pages.

What is GitHub Pages?

GitHub Pages is a hosting service that publishes a website from the static files in a repository. You put sites made of HTML, CSS and JS files on the web. The repository must contain an index.html file for publishing.

echo "Merhaba" > index.html

This file is served as the home page of the site.

Static site and hosting

A static site is made of HTML, CSS and JS files that do not need code running on the server side. The content is served the same way on every request; no database is needed. Hosting means these files can be reached on the internet.

<!DOCTYPE html>
<html>
  <body>
    <h1>Merhaba</h1>
  </body>
</html>

GitHub Pages does this hosting job for free.

Practice Create the first page

Create the index.html file and write merhaba in it. Add the file, save it quietly and print its contents.

Starter code

terminal
git init -q
# 1) index.html olustur
# 2) icine merhaba yaz
# 3) ekle ve sessizce kaydet
# 4) dosya icerigini yazdir

Sample solution

terminal
git init -q
echo "merhaba" > index.html
git add index.html
git commit -q -m "ilk sayfa"
cat index.html

Expected output

merhaba

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 What kind of sites does GitHub Pages publish?

  • Static sites made of HTML, CSS and JS files Correct answer
  • Mobile application stores
  • Dynamic applications that need a database
  • Sites that only run Python scripts

Explanation: GitHub Pages only publishes static sites; HTML, CSS and JS files are served without running on the server side.

2 Create the home page

Question
echo "merhaba" > ____.html
Answer
echo "merhaba" > index.html

Explanation: The main file of the site must be index.html; GitHub Pages serves this file as the home page.

3 Pages basics

Term Meaning
github_pages Publishes static sites
static_site Made of HTML and CSS files
hosting Serves files on the internet
index.html The home page of the site

All lessons in Advanced