SourceCraft Sites is a tool for free static website hosting without the need to configure server infrastructure. Files for a published website are hosted in a public repository of a public SourceCraft organization.
A static website is built with such client-side technologies as HTML, CSS, and JavaScript. It may not contain any scripts that run on the web server side. You can use any static website generators, e.g., Jekyll, Hugo, Gatsby, etc.
Access to websites hosted in SourceCraft Sites is arranged over the secure HTTPS protocol. You do not need to upload your own TLS certificate.
In this tutorial, you will configure hosting for a static website from a repository using SourceCraft Sites.
In the window that opens, select Blank repository.
Under Your new repository details:
In the Owner field, select the organization to create the repository in.
In the Name field, specify a name for the repository.
The name must be unique within the organization. The name may contain the following ASCII characters: lowercase and uppercase Latin letters, numbers, commas, hyphens, and underscores.
The address to access the repository at is displayed below the name.
Optionally, in the Description field, enter a description for the repository.
Under Repository template, click Browse templates and select the sites-landing template.
In the Visibility field, select the Public access type for the repository to allow view access to all internet users without authentication. Only invited users will be able to modify the repository.
Click Create repository.
Edit the original files
View the contents of the repository you created.
The repository contains the following elements for a static website:
For more information about the repository structure and technology in use, see README.md.
The SourceCraft Sites configuration in the repository already such a configuration that makes the template website available at https://<organization_slug>.sourcecraft.site/<repository_name> within a few minutes after creating the repository.
Edit the .sourcecraft/sites.yaml file or keep the default settings.
The SourceCraft Sites configuration is set up for a particular repository and stored in a file named .sourcecraft/sites.yaml. A configuration stored in the main branch, e.g., master or main, applies to the entire repository.
The general configuration format for SourceCraft Sites in .sourcecraft/sites.yaml is as follows:
root: Absolute path from the repository root to the directory with website files. This is an optional parameter. By default, it is set to the repository root.
Tip
We recommend using index.html for your website homepage.
ref: Name of the branch or tag whose files will be used to publish the static website. This is an optional parameter. By default, it is set to the repository’s main branch. Once you commit changes to the branch, the website will update automatically in a few minutes.
Copied
If you edited .sourcecraft/sites.yaml, add the modified file to the git index, then commit and push the changes to the repository’s main branch:
git add .sourcecraft/sites.yaml
git commit -m "Updated site configuration"
git push -u origin main
If you specified a website publishing branch other than the main one in the .sourcecraft/sites.yaml configuration, create that branch and switch to it:
Replace the configuration of the website home page, src/pages/index.yaml, with the one you need. By default, it contains a configuration for a SourceCraft Sites landing page. Do not rename the index.yaml file.
Add your CSS files or React components. You can see a sample configuration in the page-builder.config.yml file.
By default, the site/ directory will be cleared and overwritten with new static website files when building. If you changed the website directory in the .sourcecraft/sites.yaml settings, specify that directory in the package.json file.
Commit the changes
Add the new and modified files to the git index, then commit and push the changes to the repository branch specified in .sourcecraft/sites.yaml: