diff --git a/.eleventy.js b/.eleventy.js index 065fe0094..2ed59bdbf 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -404,7 +404,7 @@ module.exports = function (eleventyConfig) { } return content; }); - + eleventyConfig.addPassthroughCopy({ "src/site/cloudflare/": "/" }); eleventyConfig.addPassthroughCopy("src/site/img"); eleventyConfig.addPassthroughCopy("src/site/scripts"); eleventyConfig.addPassthroughCopy("src/site/styles/_theme.*.css"); diff --git a/.node-version b/.node-version new file mode 100644 index 000000000..f7ae049ea --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +20.1.0 \ No newline at end of file diff --git a/functions/api/search.js b/functions/api/search.js new file mode 100644 index 000000000..299c64ca1 --- /dev/null +++ b/functions/api/search.js @@ -0,0 +1,22 @@ +//cloudflare(page-function) search function +//requires wrangler.toml at root directory for module syntax +//requires .node-version >16 at root directory for cloudflare(page-function) +const searchHandler = require('../../netlify/functions/search/search.js').handler; +export async function onRequest({ request, next}) { + const response = await next(); + + let requestQueryParams = Object.fromEntries(new URL(request.url).searchParams); + + let event = {queryStringParameters: requestQueryParams}; + + let searchResponse = await searchHandler(event); + + const newResponse = new Response(searchResponse.body, { headers: { + 'content-type': 'application/json; charset=utf-8', + response, + } + }); + + return newResponse; +} + diff --git a/src/site/404.njk b/src/site/404.njk index 467b7fd1f..a9a6c07c5 100644 --- a/src/site/404.njk +++ b/src/site/404.njk @@ -1,4 +1,13 @@ - +--- +pagination: + size: 1 + data: mypages + alias: myurl +mypages: + - 404.html + - 404/index.html +permalink: "{{ myurl }}" +--- diff --git a/src/site/cloudflare/_redirects b/src/site/cloudflare/_redirects new file mode 100644 index 000000000..e69de29bb diff --git a/wrangler.toml b/wrangler.toml new file mode 100644 index 000000000..6708c1b1c --- /dev/null +++ b/wrangler.toml @@ -0,0 +1,3 @@ +[build.upload] +format = "modules" +main = "./worker.mjs" \ No newline at end of file