export async function onRequestGet(context) {
const url = new URL(context.request.url);
const path = url.pathname;
// 首页
if (path === "/") {
return fetch(new URL("/index.html", context.request.url));
}
// sitemap(动态生成,不用上传大文件)
if (path === "/sitemap.xml") {
const host = url.origin;
let xml = `
本文为您提供 ${keyword} 相关专业内容。
`; return new Response(html, { headers: { "Content-Type": "text/html; charset=utf-8" } }); }