Rizèl Scarlett for GitHub
Posted on • Updated on
#github #tutorial #html #beginners
GitHub Pages now uses customizable GitHub Action workflows to build and deploy your code so that developers can control their authoring framework and deployment. GitHub Pages is a powerful option for storing static content for the following reasons:
- It’s free.
- It makes collaboration easy. Anyone can open a pull request to update the site.
- Your repository syncs with any changes you made to your site.
- While GitHub Pages comes with a default domain name like,
https://YOUR_USER_NAME.github.io/
, it supports custom domains. - It uses customizable GitHub Action workflows for builds and deployments.
Let’s learn how to host static sites built with HTML on GitHub Pages!
After you create and store HTML in a repository, navigate to the settings tab for that repository.
Click Pages on the left sidebar
Under build and deployment, choose GitHub Actions
This will suggest a few workflows for you based on the code in your repository. You can choose Static HTML.
Clicking configure will lead you to a pre-made workflow. Feel free to review the YAML, tweak it to your preference, and commit the code.
Within a few seconds, your Action will start running. It will generate a URL and deploy your static site to GitHub Pages if successful.
Head over to your URL named yourusername.github.io/your_repo_name
to check out your live website!
Gotchas: handling asset paths
When I first published my site on GitHub Pages, I was confused and surprised that I couldn’t see any images or PDFs even though they were present when I locally hosted the site. This happened because GitHub Pages handles paths differently.
For example, if I have PDF living in this relative path: assets/pdfs/menu-food.pdf
, then once hosted on GitHub Pages, update the new path to {“REPOSITORY NAME”}/assets/pdfs/menu-food.pdf
Example
Here's an example repository I built using this method
blackgirlbytes / blackgyalbites
no touch restaurant menu template hosted on GitHub Pages
Template for No-touch Menus and Host Static Pages Built with Any Framework on GitHub Pages
Website built with HTML & CSS to display restaurant menus when users scan a QR code.
Powered By GitHub Pages
This is a demonstration to show developers that they can build and host static websites using any framework.See more example frameworks hosted on GitHub Pages:
Live site: https://blackgirlbytes.github.io/blackgyalbites
Design and Development
All designs and elements are open source, available for free for anyone to use.
Owned by Rizel Scarlett (@blackgirlbytes)
Designed by The Holistic Technologist
Illustrations by Cuoc Doi Prints
Feel free to fork, copy, tweak, and use for any purpose. This project is completely open source, and under MIT license.
Menu Design Template: Canva
Download Assets & Design Elements: Google Drive
Learn more
- Watch this talk delivered by Tommy Byrd on Using GitHub Pages with Actions to deploy Hugo sites in seconds
- The repository and ReadMe for Deploy Pages
- GitHub’s changelog announcement
- Official GitHub Blog Post
Watch this awesome YouTube short by Kedasha demonstrating how to use a customized workflow to deploy a static site generator to GitHub Pages!
I'd love your thoughts on the new customized workflows to deploy to GitHub Pages. Comment below! For more content like this, follow GitHub and me on DEV!
Top comments (3)
Subscribe
irishgeoff9
irishgeoff9
ceo of fabform.io
-
Email
irishgeoff9@gmail.com
-
Location
New York
-
Joined
• Sep 24 '22
- Copy link
If you wish to add a contact form to your static website on github pages. This is a handy tutorial.
Vincent A. Cicirello
Vincent A. Cicirello
Researcher and educator in A.I., algorithms, evolutionary computation, machine learning, and swarm intelligence
-
Location
NJ
-
Education
Ph.D. in Robotics, Carnegie Mellon University
-
Work
Professor of Computer Science at Stockton University
-
Joined
• Aug 12 '22
- Copy link
If I'm currently using what appears to now be called the "classic" which deploys from a branch, what is the advantage to switching a non-jekyll site to the new GitHub Actions? What kind of customizations does the new way support?
Deotyma
Deotyma
Hello I'm a javascript developer and I continue my formation in Java and Python
-
Location
Paris
-
Education
Simplon and Société Générale
-
Work
I'm a volunteer in AideUkraine.fr
-
Joined
• Dec 12 '22
- Copy link
Thanks
For further actions, you may consider blocking this person and/or reporting abuse