Files
ai-directory-platform/next.config.mjs
T
AI Directory Platform e46b4b52a3 feat: AI Directory Platform 底座升级 + 五套主题站点
- 数据模型: vote/review/submission/claim/use_case/audience/collection/event (+tool 冗余统计列)
- 社区: 投票(限流+原子toggle+API) / 评论(评分+优缺点+Helpful+聚合回写) / 提交(重复检测+审批发布) / 认领(Owner白名单编辑)
- Ranking Engine: trending/popular/most-voted/most-saved/highest-rated/new/editors-choice (纯函数可测)
- 发现体系: Use Case + Audience + Collection 三维发现 / /ai-tools-for / /best SEO 页
- Programmatic SEO: 页面生成器 / sitemap 270条 / AggregateRating/FAQPage/Breadcrumb/ItemList schema / alternatives + vs 对比页
- Analytics: event 事件流 + 外链跳转埋点 + /admin/analytics CTR 与搜索词分析
- Admin: submissions/claims/reviews/discovery/vote-audit/analytics 六个新后台 + 仪表盘扩展
- 主题系统: themes registry + 五套站点 (classic/product/editorial/niche/minimal) 构建期注入
- 认证: GitHub OAuth (env门控) + 登录回跳 redirect
- i18n: 新增 7 个命名空间中英文案 (546 键一致)
- 测试: bun test 32 用例 (ranking/slug/去重/SEO生成器) + Playwright e2e 脚本
- 种子: 14分类/16用例/9受众/40工具/6用户/投票/评论/6合集/7718事件
2026-09-08 17:38:06 +00:00

86 lines
2.2 KiB
JavaScript

import fs from "node:fs";
import path from "node:path";
import rehypePrism from "@mapbox/rehype-prism";
import nextMDX from "@next/mdx";
import remarkGfm from "remark-gfm";
import createNextIntlPlugin from 'next-intl/plugin';
const withNextIntl = createNextIntlPlugin('./src/lib/i18n.ts');
const pnpmManagedPath = path.join(process.cwd(), "node_modules", ".pnpm");
const snapshotManagedPaths = fs.existsSync(pnpmManagedPath) ? [pnpmManagedPath] : [];
/** @type {import('next').NextConfig} */
const nextConfig = {
// Docker 部署使用 standalone 输出
// 多主题构建:SITE_THEME=<id> NEXT_DIST_DIR=.next-<id> next build
// 每个主题独立产物(一个构建 = 一个站点),由 next start 直接服务
...(process.env.NEXT_DIST_DIR
? { distDir: process.env.NEXT_DIST_DIR }
: { output: "standalone" }),
images: {
remotePatterns: [
{
protocol: "https",
hostname: "i.pravatar.cc",
},
{
protocol: "https",
hostname: "images.unsplash.com",
},
{
protocol: "https",
hostname: "a.offerget.pro",
},
{
protocol: "https",
hostname: "lh3.googleusercontent.com",
},
// Google favicon 服务(种子数据 logo 来源之一)
{
protocol: "https",
hostname: "www.google.com",
},
// R2/S3 公共访问域名(上传的 logo/封面)
...(process.env.STORAGE_PUBLIC_URL
? [
{
protocol: "https",
hostname: new URL(process.env.STORAGE_PUBLIC_URL).hostname,
},
]
: []),
// 工具 logo 指向各工具官网的 favicon,域名不可枚举,放开 https 通配
{
protocol: "https",
hostname: "**",
},
],
},
pageExtensions: ["ts", "tsx", "mdx"],
turbopack: {
rules: {
'*.mdx': {
loaders: ['@mdx-js/loader'],
as: '*.js',
},
},
},
webpack(config) {
config.snapshot ??= {};
config.snapshot.managedPaths = snapshotManagedPaths;
return config;
},
};
const withMDX = nextMDX({
extension: /\.mdx?$/,
options: {
remarkPlugins: [remarkGfm],
rehypePlugins: [rehypePrism],
},
});
export default withNextIntl(withMDX(nextConfig));