Skip to content

Commit cbaedf2

Browse files
authored
Merge pull request #260 from davidwesst/ft/meta-description
Meta Tag Description. Powered by AI
2 parents 8db2bc3 + 61f56ba commit cbaedf2

File tree

10 files changed

+342
-3
lines changed

10 files changed

+342
-3
lines changed

.github/workflows/ci-cd.yml

+15
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,21 @@ jobs:
4747
npm install
4848
npm run build
4949
50+
- name: Run Playwright Tests
51+
id: test
52+
run: |
53+
npx playwright install --with-deps
54+
npx playwright test --reporter=html
55+
env:
56+
CI: true
57+
58+
- name: Upload Playwright Test Report
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: playwright-test-report
62+
path: playwright-report/index.html
63+
if-no-files-found: error
64+
5065
- name: Upload Site Files as Artifact
5166
uses: actions/upload-pages-artifact@v3
5267
with:

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,9 @@ Cargo.lock
106106

107107
# MSVC Windows builds of rustc generate these, which store debugging information
108108
*.pdb
109+
110+
# Playwright
111+
/test-results/
112+
/playwright-report/
113+
/blob-report/
114+
/playwright/.cache/

content/sitemap.webc

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
# sitemap.webc
3+
layout: null
4+
permalink: sitemap.xml
5+
eleventyExcludeFromCollections: true
6+
---
7+
<script webc:setup>
8+
const siteMapCollection = collections.all;
9+
</script>
10+
11+
<?xml version="1.0" encoding="UTF-8"?>
12+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
13+
<url webc:for="item of siteMapCollection" webc:if="item.data?.excludeFromSitemap !== true || item.data?.excludeFromSitemap === undefined">
14+
<loc @text="metadata.url + item.url"></loc>
15+
</url>
16+
</urlset>

data/metadata.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ function GetVersion() {
2222
}
2323

2424
export default {
25+
url: "https://davidwesst.com",
2526
title: "David Wesst",
26-
description: "My website",
27+
description: "Tech, games, and creative experiments from the mind of David Wesst. Come for the code, stay for the side quests.",
2728
version: GetVersion(),
2829
language: "en"
2930
}

layouts/base.webc

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<head>
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta name="description" :content="description || metadata.description">
67
<title @text="`${metadata.title} | ${title}`"></title>
78

89
<link rel="stylesheet" href="style/base.css" >

package-lock.json

+114
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"url": "git+https://github.com/davidwesst/website.git"
1212
},
1313
"engines": {
14-
"node": "^22"
14+
"node": "^23"
1515
},
1616
"scripts": {
1717
"prebuild": "concurrently 'npm run clean' 'npm run generate-tags'",
@@ -24,7 +24,8 @@
2424
"debug:eleventy": "DEBUG=Eleventy* eleventy",
2525
"generate-tags": "./tools/tag-helper.js 'content/blog' 'data/content-tags.json'",
2626
"prestart": "npm run build",
27-
"start": "http-server ./dist --port 8081"
27+
"start": "http-server ./dist --port 8081",
28+
"test": "playwright test --config=playwright.config.js"
2829
},
2930
"devDependencies": {
3031
"@11ty/eleventy": "^3.0.0",
@@ -33,12 +34,15 @@
3334
"@11ty/eleventy-plugin-rss": "^2.0.2",
3435
"@11ty/eleventy-plugin-syntaxhighlight": "^5.0.0",
3536
"@11ty/eleventy-plugin-webc": "^0.11.2",
37+
"@playwright/test": "^1.51.1",
38+
"@types/node": "^22.14.1",
3639
"concurrently": "^9.1.0",
3740
"date-fns": "^4.1.0",
3841
"gray-matter": "^4.0.3",
3942
"http-server": "^14.1.1",
4043
"rimraf": "^6.0.1",
4144
"simple-git": "^3.27.0",
45+
"xml2js": "^0.6.2",
4246
"yaml": "^2.6.1"
4347
},
4448
"type": "module"

playwright.config.js

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// @ts-check
2+
import { defineConfig, devices } from '@playwright/test';
3+
4+
/**
5+
* Read environment variables from file.
6+
* https://github.com/motdotla/dotenv
7+
*/
8+
// import dotenv from 'dotenv';
9+
// import path from 'path';
10+
// dotenv.config({ path: path.resolve(__dirname, '.env') });
11+
12+
/**
13+
* @see https://playwright.dev/docs/test-configuration
14+
*/
15+
export default defineConfig({
16+
testDir: './tests',
17+
/* Run tests in files in parallel */
18+
fullyParallel: true,
19+
/* Fail the build on CI if you accidentally left test.only in the source code. */
20+
forbidOnly: !!process.env.CI,
21+
/* Retry on CI only */
22+
retries: process.env.CI ? 2 : 0,
23+
/* Opt out of parallel tests on CI. */
24+
workers: process.env.CI ? 1 : undefined,
25+
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
26+
reporter: 'html',
27+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
28+
use: {
29+
/* Base URL to use in actions like `await page.goto('/')`. */
30+
baseURL: 'http://localhost:8080',
31+
32+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
33+
trace: 'on-first-retry',
34+
},
35+
36+
/* Configure projects for major browsers */
37+
projects: [
38+
{
39+
name: 'chromium',
40+
use: { ...devices['Desktop Chrome'] },
41+
},
42+
43+
{
44+
name: 'firefox',
45+
use: { ...devices['Desktop Firefox'] },
46+
},
47+
48+
{
49+
name: 'webkit',
50+
use: { ...devices['Desktop Safari'] },
51+
},
52+
53+
/* Test against mobile viewports. */
54+
// {
55+
// name: 'Mobile Chrome',
56+
// use: { ...devices['Pixel 5'] },
57+
// },
58+
// {
59+
// name: 'Mobile Safari',
60+
// use: { ...devices['iPhone 12'] },
61+
// },
62+
63+
/* Test against branded browsers. */
64+
// {
65+
// name: 'Microsoft Edge',
66+
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
67+
// },
68+
// {
69+
// name: 'Google Chrome',
70+
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
71+
// },
72+
],
73+
74+
webServer: {
75+
command: 'npm run dev',
76+
url: 'http://127.0.0.1:8080',
77+
reuseExistingServer: !process.env.CI,
78+
},
79+
});
80+

0 commit comments

Comments
 (0)