A template project for a static website with an admin page for content management. Frontend only, no own server required, but requires the project to live in GitHub and deploying in Netlify. Netlify Identity is used for admin user authentication and storing github access tokens for the admin users.
The site is built with Hugo and the admin management UI with Svelte. Uses icons from System UIcons.
Use this template button in the top part of this page.git clone [email protected]:<your-repo>.git.package.json for name, version, license, description and so on. To automatically update the values also in package-lock.json, run npm install. Remember to commit your changes.scripts/release match yours.New site from Git and follow the instructions to set up, selecting your production branch (e.g. production) as the branch to deploy, setting npm run build as the build command and build as the publish directory.Settings -> General -> Site details -> Site information -> Site name and take note of the domain displayed at the top of the page.Site settings -> Build & Deploy -> Environment similarly to those in .env.sample but with production values. Note that the GITHUB_PROD_BRANCH needs to be the branch you set as deploy branch in Netlify in the previous step and the DOMAIN_NAME match the domain displayed in Netlify.Identity.Settings and usage -> Identity -> Registration preferences.Settings -> Identity -> Emails. Enter the paths to the email templates (and subjects of your choice):/admin/email-templates/invitation.html/admin/email-templates/confirmation.html/admin/email-templates/password-recovery.html/admin/email-templates/email-change.html./scripts/release on your computer in a bash terminal. The script will prompt needed values. Wait for the deploy to finish: you can track the deploy in the Deploys tab in Netlify.Identity tab to be able to create an admin account.Account in your admin page and input the personal access token generated earlier. Then, reload the page to make new requests with the token set (you will need to sign in again, but there you can set the browser to remember you).dev-content, dev-live and set up environment variables: make a copy of .env.sample as .env and set the variables to match your project's development values.site/themes/<my-theme> (if you use a theme with a different name or change the name, remember to change the name in environment variables too)src/ui/App.svelte under :rootsrc/email-templatesLocal development instructions are for macOS and expect you to have homebrew and NodeJS.
If you don't have Hugo installed yet, install it with brew install hugo.
Install dependencies:
npm install
To run a local development server:
npm start
This runs a hugo development server serving files from build and sets up live reload for both hugo and svelte. The admin panel built from src folder and can be found at /admin/.
To release, i.e. update version, tag and push to production branch (no local build required):
./scripts/release
You can add new content files with (it will prompt the needed info):
npm run add-content
To test the production build locally:
npm run build
There are some issues with live reloading the svelte-side. It doesn't always load the content without manually refreshing the page.