License and https://ryanfitton.co.uk/policies/
Powered by Next.js with Tailwind CSS, hosted on Github pages.
Using template from gitHub.com/timlrx/tailwind-nextjs-starter-blog/:
- Running version
2.4.0
of gitHub.com/timlrx/tailwind-nextjs-starter-blog/; - Running Next.JS version
15.3.3
; - Running TailwindCSS version
4.1.8
; - Running Yarn version
4.9.1
; - with the following custom changes:
- A separate 'Portfolio' post section.
- Additional social icons.
- Updating the Tailwind template, including color schemes, fonts, margin/padding/font sizes, along with edits to the HTML templates and components.
- Including the use of a Cloudflare image loader so Image Transformations API can be used.
- Set up a GitHub Actions workflow to host the website and automatically upload any changes pushed to the 'main' branch.
- Setting up new 'social media' icons, as the starter template didn't include all the social icons I required, such as KeyBase, Bluesky, Buy Me A Coffee, PayPal, and others.
- Update the Sitemap and RSS feed generators to include posts from the new 'Portfolio' section.
- Google AdSense ads and component (
Ad.tsx
). - Jest and Cypress testing scripts.
-
nvm install lts/iron
. Requires at least Node.JSv20.18.1
and NPMv10.8.2
. See nodejs.org/en/about/previous-releases. -
Install required dependencies for package management:
npm install --global yarn
-
yarn
. Requires4.9.1
. This will install the required packages. See docs. -
yarn dev
. This starts the local server, which is accessible on http://localhost:3000.
Ensuring the requirements are met from the 'Running local:' section above;
-
EXPORT=1 UNOPTIMIZED=1 yarn build
. A static build will be produced in/out
-
If you have PHP installed on your system you can load the production build in a local web server:
php -S localhost:8080 -t out/
Combined Testing:
yarn run test
- Run tests for Jest and Cypress. Designed for local testing. Ensureyarn dev
has been run firstyarn run test:ci
- Runs a local dev server and tests for Jest and Cypress for CI environments. - Probably the best to use in any case.
If you want to run either Jest or Cypress separately, see below.
This will perform unit tests. Tests are stored in /__tests__
.
Commands:
yarn run test:jest-watch
- To run on only changed Test filesyarn run test:jest-ci
- If in a CI environment
This will perform unit tests. Tests are stored in /cypress/e2e
.
Commands:
yarn run test:cypress-open
- Opens Cypress for interactive testing. Ensureyarn dev
has been run firstyarn run test:cypress-run
- Will run any Cypress tests. Good for use in a CI environmentyarn run test:cypress-info
- Outputs info about Cypressyarn run test:cypress-verify
- Verify that Cypress is installed correctly and is executable
yarn run lint
. This will Lint the code.yarn run format
. This will Prettify the code.yarn run analyze
. This will analyse the bundle and open the results in a new browser window.
-
Enable Github pages in your repository, follow these instructions here.
-
Enable a custom domain for your Github Pages site. More info.
-
If required, adjust the Github Pages work flow in this repository at:
.github/workflows/static.yml
Use 1970-01-01-EXAMPLE.mdx
as an example for post content, supporting HTML or Markdown.
Exaples found in:
data/blog/1970-01-01-EXAMPLE.mdx
data/portfolio/1970-01-01-EXAMPLE.mdx
Using Prism for code block styles. In MDX documents you can use these:
For single-line code block:
`Your single-line line code block`
For multi-level code block:
Your multi-level line code block
To illustrate keyboard keys use:
<kbd>Alt + Shft</kbd>
The Cloudflare Cache is purged upon deployment in Githb Action: .github/workflows/nextjs-build-export-gh-pages-upload.yml
. Secrets are stored in Github, and correspond with the Cloudflare API key and Site ID. More info.
Google Lighthouse checks are performed upon deployment in Github Action: .github/workflows/nextjs-build-export-gh-pages-upload.yml
.
This site uses Disqus for the commenting system on blog pages. Details to configure are in data/siteMetadata.js
.
This site uses Google Analytics for the analytics. Details to configure are in data/siteMetadata.js
.
This site uses Google AdSense to deliver ads on the Blog pages. Details to configure are in data/siteMetadata.js
.
Ads are displayed in the site with the use of the Ad component: components/Ad.tsx
.
I use the PR Scheduler app (Github Marketplace). The free plan allows for up to 4 schedules per month which I find suitable for my needs.
I create a new branch which contains the new blog post, then make a PR request for the branch. In the PR, I make the comment @prscheduler 01/09/2025T11:05
which will trigger the PR Scheduler app to merge the PR on the datetime specified.
URLs to test: