Skip to content

Commit ab1b081

Browse files
authored
Merge pull request #255 from eSolia/feat/migrate-to-cloudflare-workers
feat: migrate hosting to Cloudflare Workers
2 parents 8f7a376 + aa103a0 commit ab1b081

3 files changed

Lines changed: 55 additions & 3 deletions

File tree

_config.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ import footnotes from "https://deno.land/x/lume_markdown_plugins@v0.8.0/footnote
5555
import { alert } from "npm:@mdit/plugin-alert@0.17.0";
5656

5757
// Utils
58-
import { cssBanner, shuffle, deferPagefind, externalLinksIcon } from "hibana/mod.ts";
58+
import {
59+
cssBanner,
60+
deferPagefind,
61+
externalLinksIcon,
62+
shuffle,
63+
} from "hibana/mod.ts";
5964

6065
// Assets in HTML
6166
import icons from "lume/plugins/icons.ts";
@@ -144,7 +149,13 @@ site.use(googleFonts({
144149
site.use(googleFonts({
145150
cssFile: "fonts-en.css",
146151
fontsFolder: "fonts-en",
147-
ignoredSubsets: ["cyrillic", "cyrillic-ext", "vietnamese", "latin-ext", "greek"],
152+
ignoredSubsets: [
153+
"cyrillic",
154+
"cyrillic-ext",
155+
"vietnamese",
156+
"latin-ext",
157+
"greek",
158+
],
148159
fonts: {
149160
textface:
150161
"https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100..700;1,100..700&display=swap",
@@ -395,6 +406,7 @@ site.add("manifest.json");
395406
site.add("uploads");
396407
site.add("assets");
397408
site.add("f36d0f5824b04fae955f338128bac96e.txt"); // indexnow
409+
site.add("_headers"); // Cloudflare Workers Static Assets headers config (404 handled via not_found_handling in wrangler.jsonc)
398410
// Mastodon comment system
399411
// site.add(
400412
// "https://cdn.jsdelivr.net/npm/@oom/mastodon-comments@0.3.2/src/comments.js",
@@ -445,7 +457,7 @@ site.script("makeFontpathAbsoluteJa", sedFixFontpathJa);
445457
site.addEventListener("afterBuild", "makeFontpathAbsoluteEn");
446458
site.addEventListener("afterBuild", "makeFontpathAbsoluteJa");
447459

448-
// pass the base url
460+
// pass the base url
449461
site.process([".html"], externalLinksIcon("https://blog.esolia.pro"));
450462
site.process([".html"], deferPagefind());
451463

src/_headers

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
X-Frame-Options: DENY
3+
X-XSS-Protection: 1; mode=block
4+
X-Content-Type-Options: nosniff
5+
X-Powered-By: Lume and Deno mixed with Blood Sweat and Tears
6+
X-Custom-Header: Rawr eSolia Tokyo
7+
Referrer-Policy: strict-origin-when-cross-origin
8+
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
9+
Permissions-Policy: autoplay=(), camera=(), gyroscope=(), magnetometer=(), microphone=(), payment=(), publickey-credentials-get=()
10+
11+
/fonts-*/*
12+
Cache-Control: public, max-age=31536000, immutable
13+
14+
/assets/*
15+
Cache-Control: public, max-age=31536000, immutable
16+
17+
/uploads/*
18+
Cache-Control: public, max-age=31536000, immutable

wrangler.jsonc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"$schema": "node_modules/wrangler/config-schema.json",
3+
"account_id": "ab2ac8ca4000c79ae4a66377276585be",
4+
"name": "blog-esolia-pro",
5+
"compatibility_date": "2026-05-01",
6+
"assets": {
7+
"directory": "./_site",
8+
"not_found_handling": "404-page"
9+
},
10+
"observability": {
11+
"enabled": true,
12+
"logs": {
13+
"enabled": true,
14+
"invocation_logs": true,
15+
"head_sampling_rate": 1
16+
},
17+
"traces": {
18+
"enabled": true,
19+
"head_sampling_rate": 1
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)