Next.js 博客套件:含作者、分类、标签、系列的文章,订阅源,审核评论和邮件简报
代码32 个文件上下文约 883 个 token扫描通过
安装
$
genpm add @core/kit-blog你将获得
- 源代码位于 src/app/(blog)/,共 32 个文件。 (36.2 kB)
- AI 规则位于 src/app/(blog)/AGENTS.md,另附 IDE 规则文件。
- 添加到 .env.example 的环境变量:NEWSLETTER_FROM, NEWSLETTER_POSTAL_ADDRESS, NEWSLETTER_SECRET。
- 自动为你解析 @core/blog, @core/comments, @core/kit-cms, @core/newsletter。
README
此包没有 README。
约 883 个 token→ src/app/(blog)/AGENTS.md→ .cursor/rules/genpm-core-kit-blog.mdc
这正是你的 AI 在 src/app/(blog) 中工作时读取的内容。不会向其上下文添加其他任何内容。
@core/kit-blog — rules for AI agents
Purpose
A complete blog on top of @core/kit-cms, edited in the same /admin: posts with rich text and cover images, author
profiles, categories, tags and series, scheduling, RSS/Atom/JSON feeds, site search, moderated comments, newsletter
with double opt-in and one-click unsubscribe, share links without third-party scripts and full SEO (BlogPosting
JSON-LD, sitemap, Open Graph). Glue and templates only: logic lives in @core/blog, comments and newsletter.
Map
_templates/genpm.md— the exact lines this kit adds to the project'ssrc/genpm/*.ts(generated, always current).blog/page.tsx— index (featured first,?page=).blog/[slug]/page.tsx— post.blog/{category,tag,author,series}/[slug]/page.tsx— archives (shared_lib/archive.tsx).blog/archive/[year]/[month].blog/feed.xml,blog/atom.xml,blog/feed.json— feeds.api/comments/[type]/[id]— comments (typepost).newsletter/{subscribe,confirm,unsubscribe}— routes;newsletter/{confirmed,unsubscribed,invalid}— pages._components/—PostList,PostCard,Comments,SubscribeForm,ShareLinks,blog.css(the visual template)._blocks/latest-posts.tsx— "Latest posts" block for CMS pages._lib/campaign.ts— "Create newsletter campaign" action.
Integration
- @core/kit-cms must be integrated first (follow its AGENTS.md if it was installed with this kit).
- Env:
NEWSLETTER_FROM,NEWSLETTER_POSTAL_ADDRESS,NEWSLETTER_SECRET(≥ 32 chars) and, in production,RESEND_API_KEY(see src/lib/newsletter/AGENTS.md). Explain to the person how to verify their sending domain (SPF, DKIM, DMARC) with their email provider; do not change their DNS yourself. - Migrations for @core/comments and @core/newsletter (src/lib/db/AGENTS.md).
- Add the lines of
_templates/genpm.mdto the project'ssrc/genpm/*.ts(it says which file and where): the blog collections, sitemap and search sources, thelatestPostsblock, and the admin resources (posts with "Create newsletter campaign", taxonomies, comments, newsletter) plus the pending-comments widget. - Add "Blog" to the header menu in Admin → Menus, and link the feeds from the site footer if wanted.
- Verify: create an author and a post, schedule it, check it is absent from
/blog, the feed and the sitemap until its time; comment as a guest (goes to moderation) and approve it; subscribe, confirm from the email and unsubscribe. Without an OAuth app nobody can sign in to the admin: an agent can create the author and posts withseedEntry/createEntry+publish(@core/content) from a script. WithoutRESEND_API_KEY, emails are printed to the console only undernext dev(next startis production and refuses to send without a provider).
Conventions
- Posts reference authors, categories, tags and series by slug; renaming a slug breaks links, so prefer editing names.
membersOnlyposts show only the excerpt here; with @core/billing, decide access withhasEntitlementinblog/[slug]/page.tsx.- The templates in
_componentsbelong to the project after installation: adapt markup andblog.cssfreely.
Don't
- Don't add third-party share or comment widgets (scripts and cookies without consent); keep plain links.
- Don't import subscriber lists without demonstrable consent, and never remove the unsubscribe link or postal address.
- Don't publish comments from guests without moderation unless the owner asks for it (
moderation: 'guests').
# @core/kit-blog — rules for AI agents
## Purpose
A complete blog on top of @core/kit-cms, edited in the same `/admin`: posts with rich text and cover images, author
profiles, categories, tags and series, scheduling, RSS/Atom/JSON feeds, site search, moderated comments, newsletter
with double opt-in and one-click unsubscribe, share links without third-party scripts and full SEO (BlogPosting
JSON-LD, sitemap, Open Graph). Glue and templates only: logic lives in @core/blog, comments and newsletter.
## Map
- `_templates/genpm.md` — the exact lines this kit adds to the project's `src/genpm/*.ts` (generated, always current).
- `blog/page.tsx` — index (featured first, `?page=`). `blog/[slug]/page.tsx` — post.
- `blog/{category,tag,author,series}/[slug]/page.tsx` — archives (shared `_lib/archive.tsx`). `blog/archive/[year]/[month]`.
- `blog/feed.xml`, `blog/atom.xml`, `blog/feed.json` — feeds. `api/comments/[type]/[id]` — comments (type `post`).
- `newsletter/{subscribe,confirm,unsubscribe}` — routes; `newsletter/{confirmed,unsubscribed,invalid}` — pages.
- `_components/` — `PostList`, `PostCard`, `Comments`, `SubscribeForm`, `ShareLinks`, `blog.css` (the visual template).
- `_blocks/latest-posts.tsx` — "Latest posts" block for CMS pages. `_lib/campaign.ts` — "Create newsletter campaign" action.
## Integration
1. @core/kit-cms must be integrated first (follow its AGENTS.md if it was installed with this kit).
2. Env: `NEWSLETTER_FROM`, `NEWSLETTER_POSTAL_ADDRESS`, `NEWSLETTER_SECRET` (≥ 32 chars) and, in production,
`RESEND_API_KEY` (see src/lib/newsletter/AGENTS.md). Explain to the person how to verify their sending domain
(SPF, DKIM, DMARC) with their email provider; do not change their DNS yourself.
3. Migrations for @core/comments and @core/newsletter (src/lib/db/AGENTS.md).
4. Add the lines of `_templates/genpm.md` to the project's `src/genpm/*.ts` (it says which file and where): the blog
collections, sitemap and search sources, the `latestPosts` block, and the admin resources (posts with "Create
newsletter campaign", taxonomies, comments, newsletter) plus the pending-comments widget.
5. Add "Blog" to the header menu in Admin → Menus, and link the feeds from the site footer if wanted.
6. Verify: create an author and a post, schedule it, check it is absent from `/blog`, the feed and the sitemap until
its time; comment as a guest (goes to moderation) and approve it; subscribe, confirm from the email and unsubscribe.
Without an OAuth app nobody can sign in to the admin: an agent can create the author and posts with `seedEntry` /
`createEntry` + `publish` (@core/content) from a script. Without `RESEND_API_KEY`, emails are printed to the console
only under `next dev` (`next start` is production and refuses to send without a provider).
## Conventions
- Posts reference authors, categories, tags and series by slug; renaming a slug breaks links, so prefer editing names.
- `membersOnly` posts show only the excerpt here; with @core/billing, decide access with `hasEntitlement` in `blog/[slug]/page.tsx`.
- The templates in `_components` belong to the project after installation: adapt markup and `blog.css` freely.
## Don't
- Don't add third-party share or comment widgets (scripts and cookies without consent); keep plain links.
- Don't import subscriber lists without demonstrable consent, and never remove the unsubscribe link or postal address.
- Don't publish comments from guests without moderation unless the owner asks for it (`moderation: 'guests'`).
应用 .genpmignore 后将被注入的确切目录树。固定于
// Alta en la newsletter con doble opt-in (@core/newsletter). Sin JavaScript: el navegador vuelve a la página con
// `?newsletter=<estado>` (303). La casilla de consentimiento va sin marcar; su texto versionado queda registrado.
import { AntispamFields } from '@/lib/antispam/react';
const MESSAGES: Record<string, { tone: 'success' | 'error'; text: string }> = {
pending: { tone: 'success', text: 'Almost done: check your inbox and confirm your subscription.' },
invalid: { tone: 'error', text: 'Please enter a valid email address.' },
rate_limited: { tone: 'error', text: 'Too many attempts. Please try again later.' },
consent_required: { tone: 'error', text: 'Please accept receiving the newsletter to subscribe.' },
};
/** Texto de la casilla. Si lo cambias, cambia también la versión: queda guardada con cada alta. */
export const NEWSLETTER_CONSENT = { version: 'newsletter-2026-10', text: 'I want to receive new posts by email. I can unsubscribe at any time.' };
export function SubscribeForm({ status, source = 'blog' }: { status?: string | undefined; source?: string }) {
const msg = status ? (MESSAGES[status] ?? { tone: 'error' as const, text: 'Your subscription could not be completed. Please try again.' }) : undefined;
return (
<section id="newsletter" aria-labelledby="newsletter-title" className="blk-card blog-newsletter">
<h2 id="newsletter-title">Get new posts by email</h2>
{msg && (
<p role={msg.tone === 'success' ? 'status' : 'alert'} className={`ui-alert ui-alert--${msg.tone}`}>
{msg.text}
</p>
)}
<form method="post" action="/newsletter/subscribe">
<div className="ui-field">
<label className="ui-field__label" htmlFor="newsletter-email">
Email
</label>
<input id="newsletter-email" name="email" type="email" className="ui-input" autoComplete="email" required maxLength={254} />
</div>
<div className="ui-field ui-field--check">
<input id="newsletter-consent" name="consent" type="checkbox" required />
<label htmlFor="newsletter-consent">{NEWSLETTER_CONSENT.text}</label>
</div>
<input type="hidden" name="consentVersion" value={`${NEWSLETTER_CONSENT.version}: ${NEWSLETTER_CONSENT.text}`} />
<input type="hidden" name="source" value={source} />
<AntispamFields />
<button type="submit" className="ui-button ui-button--primary">
Subscribe
</button>
<p className="blog-meta">We will send you a confirmation email.</p>
</form>
</section>
);
}
此包未声明 MCP 服务器。
| 版本 | 提交 | 发布时间 | 扫描 |
|---|---|---|---|
| 1.0.1 | fa952a4 | 5小时前 | 扫描通过 |
- 建议
- GenPM 会给出 npm 命令建议,只有你同意时才会运行。
- 被以下包使用(0)
- 目前还没有公开软件包依赖它。
- 扫描
- 扫描通过 · 0 个问题
- 提交
- v1.0.1 → fa952a4b7c71340c947de8bef049f8d9c18f7871 · 获取后已校验
- 脚本
- 无。GenPM 从不运行包中的代码。
- 许可证
- MIT
- 质量
- 100/100
- 可识别的许可证已满足
- AGENTS.md 说明了用途已满足
- AGENTS.md 包含集成步骤已满足
- AGENTS.md 列出约定或禁止事项已满足
- 包含测试已满足
- 通过安全扫描已满足
- 最近 6 个月内发布已满足
- 已验证的发布者已满足
- 摘要和关键词已满足
- 举报
- 发现问题了吗?