Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb1e356ccc | ||
|
|
7debd362f1 | ||
|
|
17e7abf1c0 | ||
|
|
6437289977 | ||
|
|
b573a0d553 | ||
|
|
af22bf7f77 | ||
|
|
4b91f67e15 | ||
|
|
2e2326b11e | ||
|
|
7ebf194d16 | ||
|
|
0ef916bf56 |
No files matched your search
@@ -7,6 +7,9 @@ on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -16,4 +19,4 @@ jobs:
|
||||
with:
|
||||
node-version: '22'
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- run: npm run check
|
||||
@@ -10,17 +10,30 @@ on:
|
||||
jobs:
|
||||
package:
|
||||
if: ${{ github.server_url == 'https://github.com' }}
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
ARCHIVE_NAME: green-tea-site-${{ github.ref_name }}.tar.gz
|
||||
RELEASE_TAG: ${{ github.ref_name }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
- name: Validate release tag
|
||||
run: |
|
||||
if [[ "$RELEASE_TAG" == */* ]]; then
|
||||
echo "Release tag must not contain '/': $RELEASE_TAG" >&2
|
||||
exit 1
|
||||
fi
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- run: npm run check
|
||||
- name: Package dist/
|
||||
run: tar -czf "green-tea-site-${{ github.ref_name }}.tar.gz" -C dist .
|
||||
run: tar -czf "$ARCHIVE_NAME" -C dist .
|
||||
- name: Verify .htaccess in archive
|
||||
run: tar -tzf "$ARCHIVE_NAME" | grep -Fx './.htaccess'
|
||||
- name: Attach to GitHub release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: green-tea-site-${{ github.ref_name }}.tar.gz
|
||||
files: ${{ env.ARCHIVE_NAME }}
|
||||
@@ -0,0 +1,49 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteCond %{HTTPS} !=on
|
||||
RewriteRule ^ https://green-tea.expressive-tea.io%{REQUEST_URI} [R=301,L]
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_expires.c>
|
||||
ExpiresActive On
|
||||
ExpiresByType text/html "access plus 0 seconds"
|
||||
ExpiresByType text/css "access plus 7 days"
|
||||
ExpiresByType text/javascript "access plus 7 days"
|
||||
ExpiresByType application/javascript "access plus 7 days"
|
||||
ExpiresByType font/woff2 "access plus 1 year"
|
||||
ExpiresByType image/avif "access plus 7 days"
|
||||
ExpiresByType image/gif "access plus 7 days"
|
||||
ExpiresByType image/jpeg "access plus 7 days"
|
||||
ExpiresByType image/png "access plus 7 days"
|
||||
ExpiresByType image/svg+xml "access plus 7 days"
|
||||
ExpiresByType image/webp "access plus 7 days"
|
||||
ExpiresByType image/x-icon "access plus 7 days"
|
||||
|
||||
<FilesMatch "\.[A-Za-z0-9_-]{8,}\.(?:avif|css|eot|gif|ico|jpe?g|js|mjs|otf|png|svg|ttf|webp|woff2?)$">
|
||||
ExpiresActive Off
|
||||
</FilesMatch>
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_headers.c>
|
||||
<FilesMatch "\.html?$">
|
||||
Header set Cache-Control "public, max-age=0, must-revalidate"
|
||||
</FilesMatch>
|
||||
|
||||
<FilesMatch "\.woff2$">
|
||||
Header set Cache-Control "public, max-age=31536000"
|
||||
</FilesMatch>
|
||||
|
||||
<FilesMatch "\.(?:avif|gif|ico|jpe?g|png|svg|webp)$">
|
||||
Header set Cache-Control "public, max-age=604800"
|
||||
</FilesMatch>
|
||||
|
||||
<FilesMatch "\.[A-Za-z0-9_-]{8,}\.(?:avif|css|eot|gif|ico|jpe?g|js|mjs|otf|png|svg|ttf|webp|woff2?)$">
|
||||
Header set Cache-Control "public, max-age=31536000, immutable"
|
||||
</FilesMatch>
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_deflate.c>
|
||||
AddOutputFilterByType DEFLATE text/html text/plain text/css text/javascript text/xml
|
||||
AddOutputFilterByType DEFLATE application/javascript application/x-javascript application/json application/ld+json
|
||||
AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml application/atom+xml image/svg+xml
|
||||
</IfModule>
|
||||
@@ -0,0 +1,93 @@
|
||||
Copyright 2021 The Zen Maru Gothic Project Authors (https://github.com/googlefonts/zen-marugothic)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
Binary file not shown.
Binary file not shown.
+224
-31
@@ -3,6 +3,8 @@ import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
||||
import { join, relative, resolve } from 'node:path';
|
||||
|
||||
const distDir = resolve('dist');
|
||||
const productionOrigin = 'https://green-tea.expressive-tea.io';
|
||||
const homeCanonical = `${productionOrigin}/`;
|
||||
|
||||
function readHtml(filePath) {
|
||||
assert.ok(existsSync(filePath), `Missing generated HTML: ${relative(distDir, filePath)}`);
|
||||
@@ -26,7 +28,39 @@ function metaTags(html, attributeName, attributeValue) {
|
||||
);
|
||||
}
|
||||
|
||||
function verifyPageMetadata({ label, html }) {
|
||||
function metaDescription(html, label) {
|
||||
const descriptions = metaTags(html, 'name', 'description');
|
||||
assert.equal(descriptions.length, 1, `${label} must have exactly one meta description`);
|
||||
const description = attribute(descriptions[0], 'content')?.trim();
|
||||
assert.ok(description, `${label} meta description must not be empty`);
|
||||
return description;
|
||||
}
|
||||
|
||||
function expectedCanonicalFor(label) {
|
||||
const generatedPath = label.replaceAll('\\', '/');
|
||||
if (generatedPath === 'index.html') return homeCanonical;
|
||||
if (generatedPath === '404.html') return `${productionOrigin}/404/`;
|
||||
assert.ok(
|
||||
generatedPath.endsWith('/index.html'),
|
||||
`Cannot derive a canonical route from generated page ${generatedPath}`,
|
||||
);
|
||||
return `${productionOrigin}/${generatedPath.slice(0, -'index.html'.length)}`;
|
||||
}
|
||||
|
||||
function requireAbsoluteHttps(value, message) {
|
||||
let parsedUrl;
|
||||
assert.doesNotThrow(
|
||||
() => {
|
||||
parsedUrl = new URL(value);
|
||||
},
|
||||
`${message} must be a valid absolute URL`,
|
||||
);
|
||||
assert.equal(parsedUrl.protocol, 'https:', `${message} must use HTTPS`);
|
||||
return value;
|
||||
}
|
||||
|
||||
function verifyPageMetadata({ label, generatedPath = label, html, isPost = false }) {
|
||||
const expectedCanonical = expectedCanonicalFor(generatedPath);
|
||||
const canonicals = tags(html, 'link').filter((tag) =>
|
||||
attribute(tag, 'rel')
|
||||
?.toLowerCase()
|
||||
@@ -35,29 +69,47 @@ function verifyPageMetadata({ label, html }) {
|
||||
);
|
||||
assert.equal(canonicals.length, 1, `${label} must have exactly one canonical URL`);
|
||||
const canonicalUrl = attribute(canonicals[0], 'href');
|
||||
assert.ok(canonicalUrl, `${label} canonical URL must not be empty`);
|
||||
let parsedCanonical;
|
||||
assert.doesNotThrow(
|
||||
() => {
|
||||
parsedCanonical = new URL(canonicalUrl);
|
||||
},
|
||||
`${label} canonical URL must be valid`,
|
||||
assert.equal(
|
||||
canonicalUrl,
|
||||
expectedCanonical,
|
||||
`${label} canonical URL must match its generated route`,
|
||||
);
|
||||
assert.ok(
|
||||
['https:', 'http:'].includes(parsedCanonical.protocol),
|
||||
`${label} canonical URL must use HTTP or HTTPS`,
|
||||
requireAbsoluteHttps(canonicalUrl, `${label} canonical URL`);
|
||||
|
||||
const description = metaDescription(html, label);
|
||||
const robots = metaTags(html, 'name', 'robots');
|
||||
assert.equal(robots.length, 1, `${label} must have exactly one robots meta tag`);
|
||||
assert.equal(
|
||||
attribute(robots[0], 'content')?.toLowerCase(),
|
||||
generatedPath === '404.html' ? 'noindex, follow' : 'index, follow',
|
||||
`${label} robots metadata has an unexpected value`,
|
||||
);
|
||||
|
||||
const descriptions = metaTags(html, 'name', 'description');
|
||||
assert.equal(descriptions.length, 1, `${label} must have exactly one meta description`);
|
||||
assert.ok(attribute(descriptions[0], 'content')?.trim(), `${label} meta description must not be empty`);
|
||||
requireSingleMeta(html, label, 'og:type', isPost ? 'article' : 'website');
|
||||
const ogUrl = attribute(requireSingleMeta(html, label, 'og:url'), 'content');
|
||||
assert.equal(ogUrl, canonicalUrl, `${label} og:url must match its canonical URL`);
|
||||
assert.ok(
|
||||
attribute(requireSingleMeta(html, label, 'og:title'), 'content')?.trim(),
|
||||
`${label} og:title must not be blank`,
|
||||
);
|
||||
assert.equal(
|
||||
attribute(requireSingleMeta(html, label, 'og:description'), 'content'),
|
||||
description,
|
||||
`${label} og:description must match its meta description`,
|
||||
);
|
||||
const ogImage = attribute(requireSingleMeta(html, label, 'og:image'), 'content');
|
||||
requireAbsoluteHttps(ogImage, `${label} og:image`);
|
||||
|
||||
return { canonicalUrl, description, ogImage };
|
||||
}
|
||||
|
||||
function findGeneratedTextAssets(directory) {
|
||||
return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
|
||||
const entryPath = join(directory, entry.name);
|
||||
if (entry.isDirectory()) return findGeneratedTextAssets(entryPath);
|
||||
return entry.isFile() && /\.(?:html|css)$/i.test(entry.name) ? [entryPath] : [];
|
||||
return entry.isFile() && /\.(?:html|css|js|mjs|svg|xml|json)$/i.test(entry.name)
|
||||
? [entryPath]
|
||||
: [];
|
||||
});
|
||||
}
|
||||
|
||||
@@ -134,12 +186,10 @@ const htmlPages = generatedTextAssets
|
||||
}));
|
||||
assert.ok(htmlPages.length > 0, 'Expected at least one generated HTML page');
|
||||
|
||||
for (const page of htmlPages) verifyPageMetadata(page);
|
||||
|
||||
function requirePage(relativePath, label) {
|
||||
const page = htmlPages.find((candidate) => candidate.label === relativePath);
|
||||
assert.ok(page, `Missing generated ${label}: ${relativePath}`);
|
||||
return { ...page, label };
|
||||
return { ...page, generatedPath: relativePath, label };
|
||||
}
|
||||
|
||||
const home = requirePage('index.html', 'home page');
|
||||
@@ -156,21 +206,106 @@ const postPages = htmlPages
|
||||
)
|
||||
.map((page) => ({
|
||||
...page,
|
||||
generatedPath: page.route,
|
||||
label: `blog post ${page.route.slice('blog/'.length, -'/index.html'.length)}`,
|
||||
}));
|
||||
assert.ok(postPages.length > 0, 'Expected at least one generated blog post');
|
||||
|
||||
const homeJsonLd = parseJsonLd(home.html, home.label);
|
||||
assert.equal(homeJsonLd.length, 1, 'home page must have exactly one JSON-LD script');
|
||||
const homeMetadata = verifyPageMetadata(home);
|
||||
const websites = findNodesByType(homeJsonLd, 'WebSite');
|
||||
assert.equal(websites.length, 1, 'home page JSON-LD must contain exactly one WebSite');
|
||||
const [website] = websites;
|
||||
assert.equal(website.name, 'Green Tea', 'home page WebSite name must be Green Tea');
|
||||
assert.equal(
|
||||
website.description,
|
||||
homeMetadata.description,
|
||||
'home page WebSite description must match the meta description',
|
||||
);
|
||||
assert.equal(website.url, homeCanonical, 'home page WebSite URL must be canonical');
|
||||
requireAbsoluteHttps(website.url, 'home page WebSite URL');
|
||||
|
||||
const softwareApplications = findNodesByType(homeJsonLd, 'SoftwareApplication');
|
||||
assert.equal(
|
||||
softwareApplications.length,
|
||||
1,
|
||||
'home page JSON-LD must contain exactly one SoftwareApplication',
|
||||
);
|
||||
const [softwareApplication] = softwareApplications;
|
||||
assert.equal(softwareApplication.name, 'Green Tea', 'SoftwareApplication name must be Green Tea');
|
||||
assert.equal(
|
||||
softwareApplication.description,
|
||||
homeMetadata.description,
|
||||
'SoftwareApplication description must match the meta description',
|
||||
);
|
||||
assert.equal(softwareApplication.url, homeCanonical, 'SoftwareApplication URL must be canonical');
|
||||
requireAbsoluteHttps(softwareApplication.url, 'SoftwareApplication URL');
|
||||
assert.equal(
|
||||
softwareApplication.applicationCategory,
|
||||
'DeveloperApplication',
|
||||
'SoftwareApplication category must be DeveloperApplication',
|
||||
);
|
||||
assert.equal(
|
||||
softwareApplication.operatingSystem,
|
||||
'Cross-platform',
|
||||
'SoftwareApplication operating system must be cross-platform',
|
||||
);
|
||||
assert.equal(
|
||||
softwareApplication.sameAs,
|
||||
'https://github.com/Expressive-Tea/green-tea',
|
||||
'SoftwareApplication sameAs must reference the GitHub repository',
|
||||
);
|
||||
assert.equal(
|
||||
softwareApplication.license,
|
||||
'https://github.com/Expressive-Tea/green-tea/blob/main/LICENSE',
|
||||
'SoftwareApplication license must reference the MIT license',
|
||||
);
|
||||
requireAbsoluteHttps(softwareApplication.license, 'SoftwareApplication license URL');
|
||||
assert.equal(typeof softwareApplication.offers, 'object', 'SoftwareApplication must have an Offer');
|
||||
assert.ok(
|
||||
findNodesByType(homeJsonLd, 'SoftwareApplication').length > 0,
|
||||
'home page JSON-LD must contain SoftwareApplication',
|
||||
!Array.isArray(softwareApplication.offers) && softwareApplication.offers !== null,
|
||||
'SoftwareApplication Offer must be an object',
|
||||
);
|
||||
assert.equal(softwareApplication.offers['@type'], 'Offer', 'SoftwareApplication offer type must be Offer');
|
||||
assert.equal(softwareApplication.offers.price, '0', 'SoftwareApplication offer price must be zero');
|
||||
assert.equal(
|
||||
softwareApplication.offers.priceCurrency,
|
||||
'USD',
|
||||
'SoftwareApplication offer currency must be USD',
|
||||
);
|
||||
|
||||
for (const page of htmlPages) {
|
||||
if (page.path === home.path || postPages.some((post) => post.path === page.path)) continue;
|
||||
verifyPageMetadata(page);
|
||||
}
|
||||
|
||||
for (const post of postPages) {
|
||||
const postMetadata = verifyPageMetadata({ ...post, isPost: true });
|
||||
const jsonLd = parseJsonLd(post.html, post.label);
|
||||
const blogPostings = findNodesByType(jsonLd, 'BlogPosting');
|
||||
assert.equal(blogPostings.length, 1, `${post.label} JSON-LD must contain one BlogPosting`);
|
||||
const [blogPosting] = blogPostings;
|
||||
assert.ok(
|
||||
typeof blogPosting.headline === 'string' && blogPosting.headline.trim(),
|
||||
`${post.label} BlogPosting headline must not be empty`,
|
||||
);
|
||||
assert.equal(
|
||||
blogPosting.description,
|
||||
postMetadata.description,
|
||||
`${post.label} BlogPosting description must match the meta description`,
|
||||
);
|
||||
assert.equal(
|
||||
blogPosting.image,
|
||||
postMetadata.ogImage,
|
||||
`${post.label} BlogPosting image must match og:image`,
|
||||
);
|
||||
requireAbsoluteHttps(blogPosting.image, `${post.label} BlogPosting image`);
|
||||
assert.equal(
|
||||
blogPosting.mainEntityOfPage,
|
||||
postMetadata.canonicalUrl,
|
||||
`${post.label} BlogPosting mainEntityOfPage must match the canonical URL`,
|
||||
);
|
||||
requireValidDate(blogPosting.datePublished, `${post.label} BlogPosting datePublished`);
|
||||
requireValidDate(blogPosting.dateModified, `${post.label} BlogPosting dateModified`);
|
||||
assert.equal(typeof blogPosting.author, 'object', `${post.label} BlogPosting author must be an object`);
|
||||
@@ -178,26 +313,84 @@ for (const post of postPages) {
|
||||
!Array.isArray(blogPosting.author) && blogPosting.author !== null,
|
||||
`${post.label} BlogPosting author must be an object`,
|
||||
);
|
||||
assert.equal(blogPosting.author['@type'], 'Person', `${post.label} BlogPosting author must be a Person`);
|
||||
assert.ok(
|
||||
typeof blogPosting.author.name === 'string' && blogPosting.author.name.trim(),
|
||||
`${post.label} BlogPosting author.name must not be empty`,
|
||||
);
|
||||
requireSingleMeta(post.html, post.label, 'og:type', 'article');
|
||||
assert.equal(typeof blogPosting.publisher, 'object', `${post.label} publisher must be an object`);
|
||||
assert.ok(
|
||||
!Array.isArray(blogPosting.publisher) && blogPosting.publisher !== null,
|
||||
`${post.label} publisher must be an object`,
|
||||
);
|
||||
assert.equal(
|
||||
blogPosting.publisher['@type'],
|
||||
'Organization',
|
||||
`${post.label} publisher must be an Organization`,
|
||||
);
|
||||
assert.equal(
|
||||
blogPosting.publisher.name,
|
||||
'Expressive Tea Team',
|
||||
`${post.label} publisher must be Expressive Tea Team`,
|
||||
);
|
||||
const publishedTime = requireSingleMeta(post.html, post.label, 'article:published_time');
|
||||
requireSingleMeta(post.html, post.label, 'article:author');
|
||||
requireValidDate(
|
||||
attribute(publishedTime, 'content'),
|
||||
`${post.label} article:published_time content`,
|
||||
const modifiedTime = requireSingleMeta(post.html, post.label, 'article:modified_time');
|
||||
const articleAuthors = metaTags(post.html, 'property', 'article:author');
|
||||
for (const articleAuthor of articleAuthors) {
|
||||
const authorUrl = attribute(articleAuthor, 'content');
|
||||
assert.ok(authorUrl?.trim(), `${post.label} article:author must not be empty`);
|
||||
let parsedAuthorUrl;
|
||||
assert.doesNotThrow(
|
||||
() => {
|
||||
parsedAuthorUrl = new URL(authorUrl);
|
||||
},
|
||||
`${post.label} article:author must be a valid absolute URL`,
|
||||
);
|
||||
assert.ok(
|
||||
['https:', 'http:'].includes(parsedAuthorUrl.protocol),
|
||||
`${post.label} article:author must use HTTP or HTTPS`,
|
||||
);
|
||||
}
|
||||
|
||||
const robots = metaTags(notFound.html, 'name', 'robots');
|
||||
assert.equal(robots.length, 1, '404 page must have exactly one robots meta tag');
|
||||
const publishedTimeContent = attribute(publishedTime, 'content');
|
||||
const modifiedTimeContent = attribute(modifiedTime, 'content');
|
||||
requireValidDate(publishedTimeContent, `${post.label} article:published_time content`);
|
||||
requireValidDate(modifiedTimeContent, `${post.label} article:modified_time content`);
|
||||
assert.equal(
|
||||
attribute(robots[0], 'content')?.toLowerCase(),
|
||||
'noindex, follow',
|
||||
'404 page robots metadata must be noindex, follow',
|
||||
publishedTimeContent,
|
||||
blogPosting.datePublished,
|
||||
`${post.label} article:published_time must match BlogPosting datePublished`,
|
||||
);
|
||||
assert.equal(
|
||||
modifiedTimeContent,
|
||||
blogPosting.dateModified,
|
||||
`${post.label} article:modified_time must match BlogPosting dateModified`,
|
||||
);
|
||||
|
||||
const articleTags = metaTags(post.html, 'property', 'article:tag').map((tag) =>
|
||||
attribute(tag, 'content')?.trim(),
|
||||
);
|
||||
assert.ok(articleTags.every(Boolean), `${post.label} article:tag values must not be empty`);
|
||||
assert.equal(
|
||||
new Set(articleTags).size,
|
||||
articleTags.length,
|
||||
`${post.label} article:tag values must not contain duplicates`,
|
||||
);
|
||||
const keywordTags =
|
||||
typeof blogPosting.keywords === 'string'
|
||||
? blogPosting.keywords.split(',').map((keyword) => keyword.trim())
|
||||
: [];
|
||||
assert.ok(keywordTags.every(Boolean), `${post.label} BlogPosting keywords must not be empty`);
|
||||
assert.equal(
|
||||
new Set(keywordTags).size,
|
||||
keywordTags.length,
|
||||
`${post.label} BlogPosting keywords must not contain duplicates`,
|
||||
);
|
||||
assert.deepEqual(
|
||||
keywordTags,
|
||||
articleTags,
|
||||
`${post.label} BlogPosting keywords must match article:tag metadata`,
|
||||
);
|
||||
}
|
||||
|
||||
for (const assetPath of generatedTextAssets) {
|
||||
const source = readFileSync(assetPath, 'utf8');
|
||||
|
||||
@@ -78,6 +78,5 @@ const chips = ['app.listen(port)', 'serveDeno(app)', 'serveBun(app)', 'edgeHandl
|
||||
display: block;
|
||||
margin-top: 0.5rem;
|
||||
font-size: 0.8rem;
|
||||
opacity: 0.75;
|
||||
}
|
||||
</style>
|
||||
@@ -30,7 +30,7 @@ class MeController {
|
||||
</div>
|
||||
|
||||
<div class="see-it__code">
|
||||
<Code code={snippet} lang="ts" theme="github-dark" />
|
||||
<Code code={snippet} lang="ts" theme="github-dark-high-contrast" />
|
||||
</div>
|
||||
|
||||
<p class="see-it__caption">Declare what you need. The framework figures out the order.</p>
|
||||
|
||||
+43
-6
@@ -3,20 +3,40 @@ import Header from '../components/Header.astro';
|
||||
import Footer from '../components/Footer.astro';
|
||||
import '../styles/global.css';
|
||||
|
||||
type OpenGraphType = 'website' | 'article';
|
||||
type StructuredData = Record<string, unknown>;
|
||||
|
||||
interface Props {
|
||||
title?: string;
|
||||
description?: string;
|
||||
image?: string;
|
||||
ogType?: OpenGraphType;
|
||||
robots?: string;
|
||||
publishedTime?: Date;
|
||||
updatedTime?: Date;
|
||||
authorUrl?: string;
|
||||
tags?: string[];
|
||||
structuredData?: StructuredData;
|
||||
}
|
||||
|
||||
const {
|
||||
title = 'Green Tea — A zen, type-safe graph-pipeline HTTP framework',
|
||||
description = 'Green Tea is a graph-pipeline HTTP framework: declare what you need, not the order to build it. Runtime-agnostic, type-safe, calm by design.',
|
||||
image = '/og.png',
|
||||
ogType = 'website',
|
||||
robots = 'index, follow',
|
||||
publishedTime,
|
||||
updatedTime,
|
||||
authorUrl,
|
||||
tags,
|
||||
structuredData,
|
||||
} = Astro.props;
|
||||
|
||||
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
|
||||
const ogImageURL = new URL(image, Astro.site);
|
||||
const canonicalURL = new URL(Astro.url.pathname, Astro.site).toString();
|
||||
const ogImageURL = new URL(image, Astro.site).toString();
|
||||
const serializedStructuredData = structuredData
|
||||
? JSON.stringify(structuredData).replace(/</g, '\\u003c')
|
||||
: undefined;
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
@@ -29,13 +49,24 @@ const ogImageURL = new URL(image, Astro.site);
|
||||
|
||||
<title>{title}</title>
|
||||
<meta name="description" content={description} />
|
||||
<meta name="robots" content={robots} />
|
||||
|
||||
<!-- Open Graph -->
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:type" content={ogType} />
|
||||
<meta property="og:url" content={canonicalURL} />
|
||||
<meta property="og:title" content={title} />
|
||||
<meta property="og:description" content={description} />
|
||||
<meta property="og:image" content={ogImageURL} />
|
||||
{
|
||||
ogType === 'article' && (
|
||||
<>
|
||||
{publishedTime && <meta property="article:published_time" content={publishedTime.toISOString()} />}
|
||||
{updatedTime && <meta property="article:modified_time" content={updatedTime.toISOString()} />}
|
||||
{authorUrl && <meta property="article:author" content={authorUrl} />}
|
||||
{tags?.map((tag) => <meta property="article:tag" content={tag} />)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
<!-- Twitter -->
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
@@ -43,13 +74,19 @@ const ogImageURL = new URL(image, Astro.site);
|
||||
<meta name="twitter:description" content={description} />
|
||||
<meta name="twitter:image" content={ogImageURL} />
|
||||
|
||||
{serializedStructuredData && <script type="application/ld+json" set:html={serializedStructuredData} />}
|
||||
|
||||
<!-- RSS -->
|
||||
<link rel="alternate" type="application/rss+xml" title="Green Tea. Blog" href="/rss.xml" />
|
||||
|
||||
<!-- Fonts -->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@500;700&display=swap" rel="stylesheet" />
|
||||
<link
|
||||
rel="preload"
|
||||
href="/fonts/zen-maru-gothic-latin-700.woff2"
|
||||
as="font"
|
||||
type="font/woff2"
|
||||
crossorigin
|
||||
/>
|
||||
|
||||
<meta name="generator" content={Astro.generator} />
|
||||
</head>
|
||||
|
||||
+31
-1
@@ -23,9 +23,39 @@ const dateFormat = new Intl.DateTimeFormat('en-US', {
|
||||
|
||||
const wordCount = body.trim().split(/\s+/).filter(Boolean).length;
|
||||
const readingTime = Math.max(1, Math.round(wordCount / 200));
|
||||
const canonicalURL = new URL(Astro.url.pathname, Astro.site).toString();
|
||||
const heroImageURL = new URL(heroImage ?? '/og.png', Astro.site).toString();
|
||||
const structuredData = {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'BlogPosting',
|
||||
headline: title,
|
||||
description,
|
||||
image: heroImageURL,
|
||||
datePublished: pubDate.toISOString(),
|
||||
dateModified: (updatedDate ?? pubDate).toISOString(),
|
||||
author: {
|
||||
'@type': 'Person',
|
||||
name: author,
|
||||
},
|
||||
publisher: {
|
||||
'@type': 'Organization',
|
||||
name: 'Expressive Tea Team',
|
||||
},
|
||||
mainEntityOfPage: canonicalURL,
|
||||
...(tags && tags.length > 0 ? { keywords: tags.join(', ') } : {}),
|
||||
};
|
||||
---
|
||||
|
||||
<Base title={`${title} — Green Tea. Blog`} description={description} image={heroImage}>
|
||||
<Base
|
||||
title={`${title} — Green Tea. Blog`}
|
||||
description={description}
|
||||
image={heroImage}
|
||||
ogType="article"
|
||||
publishedTime={pubDate}
|
||||
updatedTime={updatedDate ?? pubDate}
|
||||
tags={tags}
|
||||
structuredData={structuredData}
|
||||
>
|
||||
<article class="post section">
|
||||
<div class="wrap prose">
|
||||
<p class="post-nav"><a href="/blog/">← Back to the blog</a></p>
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ const title = '404 — Green Tea.';
|
||||
const description = 'This page steeped too long. It’s gone — but the rest of the garden is right here.';
|
||||
---
|
||||
|
||||
<Base title={title} description={description}>
|
||||
<Base title={title} description={description} robots="noindex, follow">
|
||||
<section class="notfound section">
|
||||
<div class="wrap notfound__inner">
|
||||
<div class="notfound__text">
|
||||
|
||||
+31
-1
@@ -13,9 +13,39 @@ import HonestBeta from '../components/sections/HonestBeta.astro';
|
||||
const title = 'Green Tea — Type-safe graph-pipeline framework for Node, Deno & Bun';
|
||||
const description =
|
||||
'Your API is a graph, not a middleware chain. Declare what each step needs and Green Tea computes the order — one runtime dependency, type-safe, runtime-agnostic, calm by design.';
|
||||
const canonicalURL = new URL('/', Astro.site).toString();
|
||||
const repositoryURL = 'https://github.com/Expressive-Tea/green-tea';
|
||||
const structuredData = {
|
||||
'@context': 'https://schema.org',
|
||||
'@graph': [
|
||||
{
|
||||
'@type': 'WebSite',
|
||||
'@id': `${canonicalURL}#website`,
|
||||
url: canonicalURL,
|
||||
name: 'Green Tea',
|
||||
description,
|
||||
},
|
||||
{
|
||||
'@type': 'SoftwareApplication',
|
||||
'@id': `${canonicalURL}#software`,
|
||||
name: 'Green Tea',
|
||||
description,
|
||||
applicationCategory: 'DeveloperApplication',
|
||||
operatingSystem: 'Cross-platform',
|
||||
url: canonicalURL,
|
||||
sameAs: repositoryURL,
|
||||
license: `${repositoryURL}/blob/main/LICENSE`,
|
||||
offers: {
|
||||
'@type': 'Offer',
|
||||
price: '0',
|
||||
priceCurrency: 'USD',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
---
|
||||
|
||||
<Base title={title} description={description}>
|
||||
<Base title={title} description={description} structuredData={structuredData}>
|
||||
<Hero />
|
||||
<GraphNotChain />
|
||||
<HowItCompares />
|
||||
|
||||
+21
-1
@@ -1,5 +1,25 @@
|
||||
/* Green Tea. — marketing site global styles */
|
||||
@import './brand.css';
|
||||
@font-face {
|
||||
font-family: 'Zen Maru Gothic';
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
font-display: swap;
|
||||
src: url('/fonts/zen-maru-gothic-latin-500.woff2') format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
|
||||
U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
|
||||
U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Zen Maru Gothic';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: url('/fonts/zen-maru-gothic-latin-700.woff2') format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
|
||||
U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
|
||||
U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
:root {
|
||||
--base: #0d1117;
|
||||
|
||||
Reference in new issue
Block a user