This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { escapeHtml } from '../../_helpers/escape-html.js'; | |
| export const onRequestPost = async ({ request, env }) => { | |
| try { | |
| // Accept standard form submissions | |
| const contentType = request.headers.get('content-type') || ''; | |
| if (!contentType.includes('application/x-www-form-urlencoded') && !contentType.includes('multipart/form-data')) { | |
| return new Response(JSON.stringify({ error: 'Unsupported content type' }), { | |
| status: 415, | |
| headers: { 'content-type': 'application/json' }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <form id="fs-frm" action="/api/contact" method="POST" aria-labelledby="page-title" novalidate> | |
| <div id="form-error-summary" class="form-error-summary" role="alert" tabindex="-1" hidden></div> | |
| <div id="form-status" class="form-status" role="status"></div> | |
| <div class="spm" aria-hidden="true"> | |
| <input type="checkbox" name="_akjhaskjdkjhakjshdadjknjnkdsa" tabindex="-1" autocomplete="off" /> | |
| </div> | |
| <input type="hidden" name="_redirect" value="/contact/thanks/" /> | |
| <input type="hidden" name="_append" value="false" /> | |
| <input type="hidden" name="_email.subject" value="New Message from Nooshu.com" /> | |
| <fieldset> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function() { | |
| /* check to see if the browser is modern enough to support the | |
| PerformanceNavigationTiming API */ | |
| if (!window.performance?.getEntriesByType) { | |
| console.warn('Performance API not supported'); | |
| return; | |
| } | |
| function showLoadTime() { | |
| const entries = performance.getEntriesByType('navigation'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import env from '../_data/env.js'; | |
| import { clearCssBuildCache } from '../_helpers/css-manipulation.js'; | |
| import { generatePreloadHeaders } from '../_helpers/header-generator.js'; | |
| import { compressHtmlFiles } from '../_helpers/html-compression.js'; | |
| import { compressJavaScriptFiles } from '../_helpers/js-compression.js'; | |
| import { minifyJavaScriptFiles } from '../_helpers/js-minify.js'; | |
| /** | |
| * Register eleventy.before and eleventy.after handlers. | |
| * Only registered when !env.isLocal (production/preview) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Catch-all Pages Function for HTML document content negotiation. | |
| * Serves pre-compressed Brotli 11 .br files when client sends Accept-Encoding: br, | |
| * otherwise passes through to static assets (uncompressed HTML). | |
| * Only runs for GET and HEAD; POST /api/contact is handled by functions/api/contact.js. | |
| */ | |
| async function handleHtmlWithBrotli(request, env) { | |
| const url = new URL(request.url); | |
| const pathname = url.pathname; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import fs from 'fs'; | |
| import path from 'path'; | |
| import { brotliCompress, BROTLI_LEVEL } from './compression.js'; | |
| /** | |
| * Recursively find all .html files in a directory. | |
| * @param {string} dir - Directory to search | |
| * @param {string[]} [acc=[]] - Accumulator for results | |
| * @returns {string[]} Relative paths to .html files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { brotliCompressSync } from 'zlib'; | |
| /** Default Brotli compression level (0–11). Level 11 gives best ratio, slowest. */ | |
| export const BROTLI_LEVEL = 11; | |
| /** | |
| * Compress a buffer with Brotli. | |
| * @param {Buffer | Uint8Array | string} input - Input buffer, TypedArray, or string (UTF-8) | |
| * @param {number} [level=BROTLI_LEVEL] - Brotli level 0–11 | |
| * @returns {Buffer} Compressed buffer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import fs from 'fs'; | |
| import path from 'path'; | |
| export function generatePreloadHeaders() { | |
| console.log('🔗 Generating preload headers for CSS files...'); | |
| const cssDir = path.join('./_site', 'css'); | |
| if (!fs.existsSync(cssDir)) { | |
| console.log('CSS directory not found, skipping header generation'); | |
| return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This is my site's Content Security Policy. | |
| // Modify this CSP, don't just copy / paste it! It will break your site! | |
| // You can also use `var` and `let` depending on your coding syntax, they all work | |
| const CSP = ` | |
| base-uri 'self'; | |
| child-src 'self'; | |
| connect-src 'none'; | |
| default-src 'none'; | |
| img-src 'self' https://v1.indieweb-avatar.11ty.dev/; | |
| font-src 'self'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| permalink: feed/feed.txt | |
| eleventyComputed: | |
| layout: null | |
| --- | |
| # {{ metadata.title }} - {{ metadata.author.name }} - {{ metadata.description }} | |
| ## {{ metadata.fulldescription }} | |
| URL: {{ metadata.url }} | |
| {% for post in collections.posts | reverse -%} |
NewerOlder