There are many tools to publish your site for free:
And certainly still others.
In any case, you just have to share the content of the web/prod
folder. Here is the way to host your website on GitHub Pages.
Notes:
www
subdomain
Without a personal domain name, the website URL will be: https://username.github.io
, where username is your username on GitHub.
You can order a domain name from your favorite registrar like Gandi, or do it later.
Configure Stapy with the full host as the base URL for the prod environment:
source +--- layout +--- common.json
{ "url.local": "http://127.0.0.1:1985/", "url.prod": "https://www.example.com/" }
The website URL will be here: https://www.example.com/
. Without a personal domain name, set https://username.github.io/
.
This step is optional without a personal domain mame.
We need to tell GitHub Pages our domain name. That can be done by creating a CNAME file containing the domain.
source +--- assets +--- CNAME
www.example.com
The CNAME file in the assets
directory will be copied to the website root.
Build the website:
python stapy.py build
On Windows double-click on build.py
.
The website files to be published are now in the web/prod
directory.
On GitHub, create a new public repository named username.github.io
where username is your username on GitHub.
Add files to the GitHub repository with:
You can upload files from the web/prod
directory to GitHub with the web interface.
Drag all files, then commit.
On Windows or macOS you can use a Git client like GitHub Desktop.
On Linux GitKraken is a good client.
Commit and push all the static files (web/prod
) on the GitHub repository.
cd web/prod git init git add -A git commit -m "first commit" git branch -M main git remote add origin https://github.com/{username}/{username}.github.io.git git push -u origin main
This step is optional without a personal domain mame.
From the registrar, edit the DNS zone and add a CNAME record for the www
subdomain:
On your GitHub repository, go to Settings > Pages. Enable Pages for the root directory on the main branch.
Add your custom domain (www.example.com) and enforce HTTPS.
Note: GitHub waits for DNS propagation before generating the SSL certificate. This can take a while.