mirror of
https://github.com/akazwz/smail.git
synced 2026-05-06 22:01:09 +08:00
Implement catch-all route to redirect unmatched paths to the homepage; enhance meta tags in email handler and mail detail components for better SEO compliance by formatting and ensuring noindex directives are consistently applied.
This commit is contained in:
@@ -20,4 +20,6 @@ export default [
|
||||
route("/sitemap.xml", "routes/sitemap[.]xml.tsx"),
|
||||
route("/robots.txt", "routes/robots[.]txt.tsx"),
|
||||
route("/site.webmanifest", "routes/site[.]webmanifest.tsx"),
|
||||
// 捕获所有未匹配的路径,自动跳转到首页
|
||||
route("*", "routes/$.ts"),
|
||||
] satisfies RouteConfig;
|
||||
|
||||
6
app/routes/$.ts
Normal file
6
app/routes/$.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { redirect } from "react-router";
|
||||
|
||||
export async function loader() {
|
||||
// 404页面自动跳转到首页
|
||||
return redirect("/");
|
||||
}
|
||||
@@ -119,12 +119,22 @@ export function meta() {
|
||||
{ title: "开发环境邮件处理器 - Smail" },
|
||||
{
|
||||
name: "description",
|
||||
content: "开发环境专用的邮件处理路由,用于模拟 Cloudflare Workers 的 email handler 功能。",
|
||||
content:
|
||||
"开发环境专用的邮件处理路由,用于模拟 Cloudflare Workers 的 email handler 功能。",
|
||||
},
|
||||
// 开发页面不应该被搜索引擎索引
|
||||
{ name: "robots", content: "noindex, nofollow, noarchive, nosnippet, noimageindex" },
|
||||
{ name: "googlebot", content: "noindex, nofollow, noarchive, nosnippet, noimageindex" },
|
||||
{ name: "bingbot", content: "noindex, nofollow, noarchive, nosnippet, noimageindex" },
|
||||
{
|
||||
name: "robots",
|
||||
content: "noindex, nofollow, noarchive, nosnippet, noimageindex",
|
||||
},
|
||||
{
|
||||
name: "googlebot",
|
||||
content: "noindex, nofollow, noarchive, nosnippet, noimageindex",
|
||||
},
|
||||
{
|
||||
name: "bingbot",
|
||||
content: "noindex, nofollow, noarchive, nosnippet, noimageindex",
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -163,9 +163,18 @@ export function meta({ data }: Route.MetaArgs) {
|
||||
content: "查看您在Smail临时邮箱中收到的邮件详情。",
|
||||
},
|
||||
// 即使是404页面也要阻止索引
|
||||
{ name: "robots", content: "noindex, nofollow, noarchive, nosnippet, noimageindex" },
|
||||
{ name: "googlebot", content: "noindex, nofollow, noarchive, nosnippet, noimageindex" },
|
||||
{ name: "bingbot", content: "noindex, nofollow, noarchive, nosnippet, noimageindex" },
|
||||
{
|
||||
name: "robots",
|
||||
content: "noindex, nofollow, noarchive, nosnippet, noimageindex",
|
||||
},
|
||||
{
|
||||
name: "googlebot",
|
||||
content: "noindex, nofollow, noarchive, nosnippet, noimageindex",
|
||||
},
|
||||
{
|
||||
name: "bingbot",
|
||||
content: "noindex, nofollow, noarchive, nosnippet, noimageindex",
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -180,11 +189,23 @@ export function meta({ data }: Route.MetaArgs) {
|
||||
content: `查看来自${email.fromAddress}的邮件"${email.subject || "无主题"}"。接收时间:${new Date(email.receivedAt).toLocaleDateString("zh-CN")}。`,
|
||||
},
|
||||
// 阻止搜索引擎索引邮件内容页面
|
||||
{ name: "robots", content: "noindex, nofollow, noarchive, nosnippet, noimageindex" },
|
||||
{ name: "googlebot", content: "noindex, nofollow, noarchive, nosnippet, noimageindex" },
|
||||
{ name: "bingbot", content: "noindex, nofollow, noarchive, nosnippet, noimageindex" },
|
||||
{
|
||||
name: "robots",
|
||||
content: "noindex, nofollow, noarchive, nosnippet, noimageindex",
|
||||
},
|
||||
{
|
||||
name: "googlebot",
|
||||
content: "noindex, nofollow, noarchive, nosnippet, noimageindex",
|
||||
},
|
||||
{
|
||||
name: "bingbot",
|
||||
content: "noindex, nofollow, noarchive, nosnippet, noimageindex",
|
||||
},
|
||||
// 阻止缓存
|
||||
{ "http-equiv": "cache-control", content: "no-cache, no-store, must-revalidate" },
|
||||
{
|
||||
"http-equiv": "cache-control",
|
||||
content: "no-cache, no-store, must-revalidate",
|
||||
},
|
||||
{ "http-equiv": "pragma", content: "no-cache" },
|
||||
{ "http-equiv": "expires", content: "0" },
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user