fix(search): 搜索页一律 noindex,并把配色对齐 template-07
两处收尾,均针对当前启用的 template-07。 1) SEO 收口(ticket 05) 原实现只在带关键词时 noindex,不带关键词时输出 index,follow——等于邀请 搜索引擎收录一个只有「请输入关键词」的空页。改为无条件 noindex,follow: - 带关键词:同一批内容有无数种关键词组合入口,典型低质量/易重复页面 (沿用 useModuleRoute.ts 对 /article?keywords= 的既有约定) - 不带关键词:空页,对搜索引擎和用户都是垃圾页 - 保留 follow 而非 nofollow,让爬虫仍能顺着结果链接爬到详情页 无关键词时空页保持显示引导文案,不 404、不重定向——被索引才是问题, 而它已被 noindex 解决。canonical 维持指向 /search;sitemap 经运行时验证 本就不含搜索页(269 条 URL 无命中)。 明确不做:不把 /search 加进 robots.txt 的 Disallow。Disallow 是「禁止抓取」, 爬虫遵守后就不会去读页面里的 noindex,URL 仍可能出现在结果里(只是没有标题 摘要)——反而更糟。故 server/api/robots.txt.ts 未改动。 2) 配色对齐 template-07 搜索页原用 navy #1E2A47,与本模板不符:template-07 主色是 #1a6dff, 其 TenderList 用 text-blue-600 渲染价格。已改为: - 主色(按钮/聚焦边框/选中 Tab/计数)#1E2A47 -> #1a6dff - 标书价格 red #E5472E -> #2563eb(对齐 TenderList 的 text-blue-600) - 链接蓝统一为小写 #2563eb 实测:带/不带关键词两种情况的 robots 均为 noindex,follow;页面总数与三个 Tab 渲染正常;eslint 0 error / 0 warning。
This commit is contained in:
@@ -7,11 +7,11 @@
|
||||
v-model="inputKeyword"
|
||||
type="text"
|
||||
placeholder="请输入关键词..."
|
||||
class="min-w-0 flex-1 rounded-full border border-gray-300 bg-[#F9FAFB] px-4 py-2.5 text-sm outline-none transition-colors focus:border-[#1E2A47] focus:bg-white"
|
||||
class="min-w-0 flex-1 rounded-full border border-gray-300 bg-[#F9FAFB] px-4 py-2.5 text-sm outline-none transition-colors focus:border-[#1a6dff] focus:bg-white"
|
||||
>
|
||||
<button
|
||||
type="submit"
|
||||
class="shrink-0 rounded-full bg-[#1E2A47] px-6 py-2.5 text-sm text-white transition-opacity hover:opacity-90"
|
||||
class="shrink-0 rounded-full bg-[#1a6dff] px-6 py-2.5 text-sm text-white transition-opacity hover:opacity-90"
|
||||
>
|
||||
搜索
|
||||
</button>
|
||||
@@ -25,7 +25,7 @@
|
||||
<template v-else>
|
||||
<!-- 结果统计 -->
|
||||
<p class="mb-4 text-sm text-gray-500">
|
||||
找到 <span class="font-semibold text-[#1E2A47]">{{ totalCount }}</span> 条与「{{ keywords }}」相关的内容
|
||||
找到 <span class="font-semibold text-[#1a6dff]">{{ totalCount }}</span> 条与「{{ keywords }}」相关的内容
|
||||
</p>
|
||||
|
||||
<!-- 全部为空(且无故障) -->
|
||||
@@ -42,7 +42,7 @@
|
||||
:key="tab.key"
|
||||
type="button"
|
||||
class="relative -mb-0.5 cursor-pointer border-b-2 border-transparent bg-transparent px-4 py-3 text-sm text-gray-500 transition-colors"
|
||||
:class="activeTab === tab.key ? 'border-b-[#1E2A47] font-semibold text-[#1E2A47]' : ''"
|
||||
:class="activeTab === tab.key ? 'border-b-[#1a6dff] font-semibold text-[#1a6dff]' : ''"
|
||||
@click="activeTab = tab.key"
|
||||
>
|
||||
{{ tab.label }}
|
||||
@@ -111,7 +111,7 @@
|
||||
<div class="mt-1.5 flex flex-wrap gap-3 text-xs text-gray-400">
|
||||
<span v-if="item.projectNo">编号:{{ item.projectNo }}</span>
|
||||
<span v-if="item.tenderer">招标人:{{ item.tenderer }}</span>
|
||||
<span v-if="item.tenderPrice != null" class="font-semibold text-[#E5472E]">
|
||||
<span v-if="item.tenderPrice != null" class="font-semibold text-[#2563eb]">
|
||||
¥ {{ formatMoney(item.tenderPrice) }}
|
||||
</span>
|
||||
<span v-if="item.deadlineTime">截止:{{ formatDate(item.deadlineTime) }}</span>
|
||||
@@ -121,7 +121,7 @@
|
||||
|
||||
<!-- 查看更多(无结果/失败时不显示) -->
|
||||
<div v-if="moreLink" class="border-t border-gray-100 px-5 py-3 text-right">
|
||||
<NuxtLink :to="moreLink" class="text-[13px] text-[#2563EB] hover:underline">
|
||||
<NuxtLink :to="moreLink" class="text-[13px] text-[#2563eb] hover:underline">
|
||||
查看更多{{ TAB_LABEL[activeTab] }} →
|
||||
</NuxtLink>
|
||||
</div>
|
||||
@@ -319,8 +319,11 @@ function onSubmit() {
|
||||
}
|
||||
|
||||
// ===== SEO =====
|
||||
// 带关键词的结果页是低质量/易重复页面,禁止被索引(沿用 useModuleRoute.ts 的既有约定);
|
||||
// follow 让爬虫仍能顺着结果里的链接爬到详情页。
|
||||
// 搜索页一律 noindex,**不区分有没有关键词**:
|
||||
// - 带关键词:同一批内容有无数种关键词组合入口,是典型低质量/易重复页面
|
||||
// (沿用 useModuleRoute.ts 对 /article?keywords= 的既有约定)。
|
||||
// - 不带关键词:一个只有「请输入关键词」的空页,对搜索引擎和用户都是垃圾页。
|
||||
// follow 保留:让爬虫仍能顺着结果里的链接爬到详情页,不浪费抓取预算。
|
||||
usePageSeo(
|
||||
{
|
||||
title: keywords.value ? `搜索"${keywords.value}"` : '搜索',
|
||||
@@ -329,7 +332,5 @@ usePageSeo(
|
||||
siteInfo.value
|
||||
)
|
||||
|
||||
if (keywords.value) {
|
||||
useSeoMeta({ robots: 'noindex, follow' })
|
||||
}
|
||||
useSeoMeta({ robots: 'noindex, follow' })
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user