提问背景 Question:
出错了,刚才的没问题。这个事情先这样吧。然后得修改首页了。下面是你之前的首页,感觉不错。
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI 智库百科 - 汇聚高价值AI对话</title>
<!-- 引入 Tailwind CSS CDN -->
<script src="https://cdn.tailwindcss.com"></script>
<style>
/* 自定义微调 */
.glass-effect {
background: rgba(255, 255, 255, 0.8);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
}
</style>
</head>
<body class="bg-slate-50 text-slate-800 font-sans antialiased min-h-screen pb-12">
<!-- 顶部导航栏 -->
<header class="sticky top-0 z-50 glass-effect border-b border-slate-200/80">
<div class="max-w-5xl mx-auto px-4 h-16 flex items-center justify-between">
<div class="flex items-center space-x-2">
<span class="text-2xl">🧠</span>
<span class="font-bold text-lg bg-gradient-to-r from-indigo-600 to-violet-600 bg-clip-text text-transparent">AI 智库百科</span>
</div>
<div class="flex items-center space-x-3">
<button class="p-2 text-slate-500 hover:text-slate-700 transition">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" /></svg>
</button>
<span class="text-xs bg-indigo-50 text-indigo-600 px-2 py-1 rounded-full font-medium">共 1,204 条沉淀</span>
</div>
</div>
</header>
<!-- 主体区域 -->
<main class="max-w-5xl mx-auto px-4 mt-6 space-y-8">
<!-- 搜索与 Slogan 区 (支持移动端手势与布局) -->
<div class="bg-gradient-to-br from-indigo-900 to-slate-900 rounded-3xl p-6 md:p-10 text-white shadow-xl relative overflow-hidden">
<!-- 背景装饰微光 -->
<div class="absolute -right-10 -top-10 w-40 h-40 bg-indigo-500 rounded-full blur-3xl opacity-30"></div>
<div class="absolute -left-10 -bottom-10 w-40 h-40 bg-violet-500 rounded-full blur-3xl opacity-30"></div>
<div class="relative z-10 space-y-4 max-w-2xl">
<span class="px-2.5 py-1 text-xs bg-indigo-500/30 text-indigo-200 rounded-full font-medium tracking-wide">知识沉淀计划</span>
<h1 class="text-2xl md:text-3xl font-extrabold tracking-tight leading-tight">检索高价值人工智能对话与行业洞察</h1>
<p class="text-sm text-slate-300">基于真实日常对话二次精选,把碎片化的AI聊天转化为结构化的知识百科。</p>
<!-- 搜索框 -->
<form action="/search" method="GET" class="pt-2">
<div class="relative flex items-center bg-white rounded-2xl p-1.5 shadow-lg">
<span class="pl-3 text-slate-400">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" /></svg>
</span>
<input type="text" name="q" placeholder="输入关键字,如: AI Agent, SQLite, 提示词优化..." class="w-full px-3 py-2.5 text-slate-800 placeholder-slate-400 bg-transparent outline-none text-sm md:text-base" />
<button type="submit" class="bg-indigo-600 hover:bg-indigo-700 text-white px-5 py-2.5 rounded-xl text-sm font-medium transition shrink-0">搜索</button>
</div>
</form>
</div>
</div>
<!-- 热门标签区 (关联 cms_tag 数据库表) -->
<section class="space-y-3">
<div class="flex items-center justify-between">
<h2 class="text-lg font-bold text-slate-800 flex items-center"><span class="mr-2">🏷️</span> 热门主题标签</h2>
<a href="#" class="text-xs text-indigo-600 font-medium hover:underline">全部标签 →</a>
</div>
<!-- 标签包裹区 -->
<div class="flex flex-wrap gap-2">
<!-- 每一个标签对应 cms_tag 数据行 -->
<a href="#" class="flex items-center space-x-1 px-3 py-1.5 bg-white border border-slate-200 hover:border-indigo-400 hover:bg-indigo-50/30 rounded-xl text-xs md:text-sm text-slate-600 transition">
<span class="font-medium"># AI Agent</span>
<span class="text-[10px] bg-slate-100 text-slate-400 px-1.5 py-0.5 rounded-md">142</span>
</a>
<a href="#" class="flex items-center space-x-1 px-3 py-1.5 bg-white border border-slate-200 hover:border-indigo-400 hover:bg-indigo-50/30 rounded-xl text-xs md:text-sm text-slate-600 transition">
<span class="font-medium"># SQLite 调优</span>
<span class="text-[10px] bg-slate-100 text-slate-400 px-1.5 py-0.5 rounded-md">58</span>
</a>
<a href="#" class="flex items-center space-x-1 px-3 py-1.5 bg-white border border-slate-200 hover:border-indigo-400 hover:bg-indigo-50/30 rounded-xl text-xs md:text-sm text-slate-600 transition">
<span class="font-medium"># 提示词工程</span>
<span class="text-[10px] bg-slate-100 text-slate-400 px-1.5 py-0.5 rounded-md">97</span>
</a>
<a href="#" class="flex items-center space-x-1 px-3 py-1.5 bg-white border border-slate-200 hover:border-indigo-400 hover:bg-indigo-50/30 rounded-xl text-xs md:text-sm text-slate-600 transition">
<span class="font-medium"># 大模型架构</span>
<span class="text-[10px] bg-slate-100 text-slate-400 px-1.5 py-0.5 rounded-md">112</span>
</a>
<a href="#" class="flex items-center space-x-1 px-3 py-1.5 bg-white border border-slate-200 hover:border-indigo-400 hover:bg-indigo-50/30 rounded-xl text-xs md:text-sm text-slate-600 transition">
<span class="font-medium"># 知识库建设</span>
<span class="text-[10px] bg-slate-100 text-slate-400 px-1.5 py-0.5 rounded-md">43</span>
</a>
</div>
</section>
<!-- 最新及高价值内容展示区 (关联 cms_article 数据表) -->
<section class="space-y-4">
<div class="flex items-center justify-between">
<h2 class="text-lg font-bold text-slate-800 flex items-center"><span class="mr-2">⚡</span> 最新收录百科</h2>
<div class="flex space-x-1 bg-slate-200/60 p-0.5 rounded-lg text-xs">
<button class="px-3 py-1 bg-white text-slate-800 font-medium rounded-md shadow-sm">最新</button>
<button class="px-3 py-1 text-slate-500 hover:text-slate-800">最热</button>
</div>
</div>
<!-- 文章卡片列表 (单列布局,移动端至电脑端自适应) -->
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<!-- 卡片一 (对应 cms_article 表中一条数据) -->
<article class="bg-white border border-slate-200 hover:border-indigo-200 rounded-2xl p-5 hover:shadow-md transition flex flex-col justify-between">
<div class="space-y-2">
<!-- 文章分类与热度 -->
<div class="flex items-center justify-between text-xs">
<span class="text-indigo-600 font-semibold uppercase tracking-wider">深度解析</span>
<span class="text-slate-400 flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-3.5 w-3.5 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" /></svg>
1,280 次阅读
</span>
</div>
<!-- 标题 (对应 title) -->
<h3 class="font-bold text-base md:text-lg text-slate-900 hover:text-indigo-600 transition">
<a href="/article/1">什么是 AI Agent?为什么说它是大模型的下半场?</a>
</h3>
<!-- 描述摘要 (对应 description) -->
<p class="text-xs md:text-sm text-slate-500 line-clamp-2 leading-relaxed">
本文深度解析当前大热的 AI Agent(智能体)概念,系统阐述其与传统单次大模型调用的区别,并拆解其自主规划、记忆系统及工具调用的核心架构。
</p>
</div>
<!-- 底部附加信息:标签 (关联 cms_article_tag) 与日期 -->
<div class="flex items-center justify-between pt-4 mt-4 border-t border-slate-100 text-xs">
<div class="flex gap-1.5">
<span class="bg-slate-100 text-slate-600 px-2 py-0.5 rounded">AI Agent</span>
<span class="bg-slate-100 text-slate-600 px-2 py-0.5 rounded">概念科普</span>
</div>
<span class="text-slate-400">1小时前</span>
</div>
</article>
<!-- 卡片二 -->
<article class="bg-white border border-slate-200 hover:border-indigo-200 rounded-2xl p-5 hover:shadow-md transition flex flex-col justify-between">
<div class="space-y-2">
<div class="flex items-center justify-between text-xs">
<span class="text-emerald-600 font-semibold uppercase tracking-wider">工程实践</span>
<span class="text-slate-400 flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-3.5 w-3.5 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" /></svg>
845 次阅读
</span>
</div>
<h3 class="font-bold text-base md:text-lg text-slate-900 hover:text-indigo-600 transition">
<a href="/article/2">深度解析大模型长期记忆的技术实现原理</a>
</h3>
<p class="text-xs md:text-sm text-slate-500 line-clamp-2 leading-relaxed">
如何突破大模型无状态的天然瓶颈?详细剖析网页端AI助手利用云端多维数据库、RAG检索增强及向量数据库技术构建长期记忆系统的底层逻辑。
</p>
</div>
<div class="flex items-center justify-between pt-4 mt-4 border-t border-slate-100 text-xs">
<div class="flex gap-1.5">
<span class="bg-slate-100 text-slate-600 px-2 py-0.5 rounded">长期记忆</span>
<span class="bg-slate-100 text-slate-600 px-2 py-0.5 rounded">RAG</span>
</div>
<span class="text-slate-400">昨天</span>
</div>
</article>
</div>
</section>
</main>
</body>
</html>
再后面是你目前给我用的首页,但我喜欢之前的。帮我改进。
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>AI 知识百科 - bbsgood.com</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-50 text-gray-800">
<!-- 导航栏 -->
<header class="bg-white border-b sticky top-0 z-50 shadow-sm">
<div
class="max-w-6xl mx-auto px-4 h-16 flex items-center justify-between"
>
<a href="/baike" class="flex items-center space-x-2">
<span
class="text-xl font-bold bg-gradient-to-r from-blue-600 to-indigo-600 bg-clip-text text-transparent"
>BBSGOOD 百科</span
>
</a>
<nav class="hidden md:flex space-x-6">
<a href="/" class="text-gray-600 hover:text-blue-600">社区首页</a>
<a href="/baike" class="text-blue-600 font-medium">百科主页</a>
</nav>
</div>
</header>
<!-- 主体内容 -->
<main class="max-w-6xl mx-auto px-4 py-8">
<!-- 搜索与标语 -->
<div class="text-center max-w-2xl mx-auto mb-10">
<h1 class="text-2xl md:text-3xl font-extrabold text-gray-900 mb-4">
海量 AI 精选对话与知识库
</h1>
<p class="text-gray-500 mb-6">搜索你感兴趣的 AI 问答,积累数字资产</p>
<!-- 搜索框表单 -->
<form action="/baike" method="GET" class="relative">
<input
type="text"
name="q"
value="{{.Keyword}}"
placeholder="搜索高价值知识、问题或标签..."
class="w-full px-5 py-3 pr-12 rounded-full border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 shadow-sm transition"
/>
<button
type="submit"
class="absolute right-3 top-1/2 -translate-y-1/2 p-2 bg-blue-600 hover:bg-blue-700 text-white rounded-full transition"
>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-5 w-5"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
/>
</svg>
</button>
</form>
</div>
<!-- 左右分栏 -->
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<!-- 左侧核心文章列表 (占2栏) -->
<div class="lg:col-span-2 space-y-4">
<h2
class="text-lg font-bold text-gray-900 flex items-center space-x-2 border-b pb-2"
>
<span
>{{if
.Keyword}}“{{.Keyword}}”的搜索结果{{else}}最新收录百科{{end}}</span
>
</h2>
{{if .Articles}} {{range .Articles}}
<article
class="bg-white p-5 rounded-xl border border-gray-100 hover:border-blue-500 shadow-sm hover:shadow-md transition duration-200"
>
<h3
class="text-lg font-bold text-gray-900 mb-2 hover:text-blue-600"
>
<a href="/baike/article/{{.ID}}">{{.Title}}</a>
</h3>
<p class="text-gray-600 text-sm mb-4 line-clamp-2">
{{.Description}}
</p>
<div
class="flex items-center justify-between text-xs text-gray-400"
>
<div class="flex items-center space-x-3">
<span class="bg-gray-100 text-gray-600 px-2.5 py-1 rounded"
>浏览 {{.ClickCount}}</span
>
</div>
<span>{{.CreatedAt}}</span>
</div>
</article>
{{end}} {{else}}
<div
class="bg-white p-12 text-center rounded-xl border border-gray-100"
>
<p class="text-gray-400 text-sm">
暂无匹配百科内容,换个关键词试试吧!
</p>
</div>
{{end}}
</div>
<!-- 右侧侧边栏 (占1栏) -->
<div class="space-y-6">
<!-- 热门标签云 -->
<div class="bg-white p-5 rounded-xl border border-gray-100 shadow-sm">
<h3 class="font-bold text-gray-900 mb-4 pb-2 border-b">热门标签</h3>
<div class="flex flex-wrap gap-2">
{{range .HotTags}}
<a
href="/baike?tag={{.Name}}"
class="text-xs bg-blue-50 hover:bg-blue-100 text-blue-700 px-3 py-1.5 rounded-full transition"
>
# {{.Name}}
<span class="text-blue-400 font-mono">({{.Count}})</span>
</a>
{{else}}
<span class="text-gray-400 text-xs">暂无标签数据</span>
{{end}}
</div>
</div>
</div>
</div>
</main>
<footer
class="bg-white border-t mt-12 py-6 text-center text-xs text-gray-400"
>
<p>© 2024 bbsgood.com All Rights Reserved.</p>
</footer>
</body>
</html>
AI智库百科原生首页
为您重构后的AI智库百科首页原生 HTML 模板已经出炉。此版本完全清除了外部 Tailwind CSS CDN 脚本,改用全原生 CSS 变量、Grid/Flex 现代网格系统开发,完美继承了您钟爱的深色渐变微光 Banner、精致磨砂玻璃头部、自适应双栏及卡片 hover 动态光泽,同时完美兼容了 Go 模板的数据循环、标签加载与搜索回显。
你可以直接将整段代码拷贝保存为您的主页模板:
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name=