@caltho/site-kit 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/content/index.d.ts +2 -1
- package/dist/policies.js +9 -3
- package/dist/prepare.js +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -57,7 +57,7 @@ the kit only checks it's a URL.
|
|
|
57
57
|
| --- | --- |
|
|
58
58
|
| **Content** (`@caltho/site-kit/content`) | `defineSite` and the pieces to build blocks from (`text`, `md`, `image`, `link`, `href`, `business`, …); the checks, including that every link lands on a page and every `#part` exists; the JSON Schema. |
|
|
59
59
|
| **prepare** | Loads the content from CalOS (`CALOS_CONTENT_URL`, `CALOS_SITE_TOKEN`; the site's own while nothing's published there) or `content/site.json`, sends CalOS the schema, checks it, writes the schema, and makes every picture the content names as WebP at the widths screens need plus a 1200×630 share crop, named by content so they cache for a year. |
|
|
60
|
-
| **finish** | After the framework's build: a content security policy in every page (each inline script named by hash), `_headers` (security headers, long caching, `noindex` on preview addresses), and `_redirects` from CalOS (`CALOS_REDIRECTS_URL`; a build that can't reach CalOS fails rather than lose them). Where CalOS counts the site's visits (its content answer says where they go), the analytics script in every published page but the preview, with its addresses in the policy, and phone and map links marked so a tap is counted (`phone_tap`, `directions_tap`; a link marked `data-track` already is left as it is). No cookies. |
|
|
60
|
+
| **finish** | After the framework's build: a content security policy in every page (each inline script named by hash), `_headers` (security headers, long caching, `noindex` on preview addresses), and `_redirects` from CalOS (`CALOS_REDIRECTS_URL`; a build that can't reach CalOS fails rather than lose them). Where CalOS counts the site's visits (its content answer says where they go), the analytics script in every published page but the preview, with its addresses in the policy, and phone and map links marked so a tap is counted (`phone_tap`, `directions_tap`; a link marked `data-track` already is left as it is). No cookies. The standard privacy policy then leaves out its claim of no analytics, saying nothing in its place: what to say of the counting is the business's (`extra`). |
|
|
61
61
|
| **check** | Every page in a real browser on a computer and a phone: fails on anything the policy blocks and anything that doesn't load. What axe finds (WCAG 2.0–2.2 A and AA, best practice) is said with where, for the site to weigh (a colour the business chose over the contrast rule is their choice); `--strict` fails on it too, `--allow=rule,rule` leaves named rules out. |
|
|
62
62
|
| **Search** | Titles that fit, canonical addresses, the business as schema.org data (hours, areas, address), FAQ and breadcrumb data, robots.txt, the sitemap. |
|
|
63
63
|
| **Policies** | Privacy, accessibility and terms, written from the business's facts and what the site does. Optional: a site calls `policy()` where it wants them. |
|
package/dist/content/index.d.ts
CHANGED
|
@@ -170,7 +170,8 @@ export type SiteBase = {
|
|
|
170
170
|
footer?: Footer;
|
|
171
171
|
look?: Look;
|
|
172
172
|
redirects: Redirect[]; /** Whether page paths end in a slash (the default). */
|
|
173
|
-
trailingSlash?: boolean;
|
|
173
|
+
trailingSlash?: boolean; /** Set by prepare, never in content: CalOS counts this site's visits (its pages carry the script), which its privacy policy says. */
|
|
174
|
+
countsVisits?: boolean;
|
|
174
175
|
};
|
|
175
176
|
/**
|
|
176
177
|
* The site's menu, as its header draws it: the one edited in CalOS (its links in order, one picked out,
|
package/dist/policies.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
// The policy pages a business's site should have, written from what the business has told us and
|
|
2
2
|
// what the template actually does: no cookies, no analytics, no third-party requests, a contact
|
|
3
3
|
// form that goes to the business's CalOS. So the words stay true as the site changes: add a
|
|
4
|
-
// tracker to the template and this is where it has to be said.
|
|
5
|
-
//
|
|
4
|
+
// tracker to the template and this is where it has to be said. Where the business has CalOS count
|
|
5
|
+
// its visits (prepare marks it: site.countsVisits), the claim of no analytics is left out and
|
|
6
|
+
// nothing said in its place: what to say of the counting is the business's, in `extra` (CalOS
|
|
7
|
+
// suggests a paragraph as they turn it on). Plain language, US-first; a business adds its own
|
|
8
|
+
// paragraphs with `extra`, and should have a lawyer read them once.
|
|
6
9
|
/**
|
|
7
10
|
* `collectsFromForm`: the site has a form that takes a visitor's name, email and message, which the
|
|
8
11
|
* privacy policy says (it defaults to the site having a form address).
|
|
@@ -13,6 +16,7 @@ export function policy(site, which, o = {}) {
|
|
|
13
16
|
const reach = [b.email ? `email [${b.email}](mailto:${b.email})` : null, b.phone ? `call ${b.phone}` : null].filter(Boolean).join(" or ");
|
|
14
17
|
const place = b.address ? `${b.address.locality}, ${b.address.region}` : null;
|
|
15
18
|
const hasForm = o.collectsFromForm ?? !!site.form;
|
|
19
|
+
const counts = !!site.countsVisits;
|
|
16
20
|
if (which === "privacy") {
|
|
17
21
|
return {
|
|
18
22
|
title: "Privacy policy",
|
|
@@ -27,7 +31,9 @@ export function policy(site, which, o = {}) {
|
|
|
27
31
|
]
|
|
28
32
|
.filter(Boolean)
|
|
29
33
|
.join("\n"),
|
|
30
|
-
|
|
34
|
+
counts
|
|
35
|
+
? `This site doesn't use cookies or advertising trackers. Its fonts and pictures come from this site itself.`
|
|
36
|
+
: `This site doesn't use cookies, advertising or analytics trackers. Its fonts and pictures come from this site itself, so visiting it doesn't tell anyone else you were here.`,
|
|
31
37
|
`## How we use it`,
|
|
32
38
|
`To answer you, to quote for and do the work you ask about, and to keep the records the law requires. We keep enquiries in our customer records system, which Caltho runs for us. We don't sell or rent your information, and we don't share it for advertising. The companies that help us run this site and our business (hosting, email, records) only use it to do that for us.`,
|
|
33
39
|
`## How long we keep it`,
|
package/dist/prepare.js
CHANGED
|
@@ -92,6 +92,11 @@ export async function prepare(root, env = process.env, log = console.log) {
|
|
|
92
92
|
if (parsed.problems)
|
|
93
93
|
throw new Error(`The site's content needs fixing (${from}):\n - ${parsed.problems.join("\n - ")}`);
|
|
94
94
|
const site = parsed.site;
|
|
95
|
+
// Its pages will count visits (finish puts the script in): what its privacy policy says follows.
|
|
96
|
+
if (analytics)
|
|
97
|
+
site.countsVisits = true;
|
|
98
|
+
else
|
|
99
|
+
delete site.countsVisits;
|
|
95
100
|
for (const w of parsed.warnings)
|
|
96
101
|
log(`site-kit: warning: ${w}`);
|
|
97
102
|
const schema = definition.jsonSchema();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caltho/site-kit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "What every Caltho site is built with: the contract with CalOS (content, and how a site declares what is editable), images, search and security, and the checks",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|