Use /{id}/{fa-slug} detail URLs in sitemaps and add public by-id lookups.

Default sitemap templates now emit SEO-friendly Farsi path segments with stable CMS ids; storefronts resolve content via new by-id public endpoints.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-08-22 23:43:25 +03:30
co-authored by Cursor
parent 1b16e79d3f
commit 7cef24336a
16 changed files with 495 additions and 25 deletions
+5
View File
@@ -99,6 +99,11 @@ export class PublicBlogsController {
return this.service.listPublic(host, query);
}
@Get('by-id/:blogId')
getById(@Param('host') host: string, @Param('blogId') blogId: string) {
return this.service.getPublicById(host, blogId);
}
@Get(':blogId/comments')
listComments(@Param('host') host: string, @Param('blogId') blogId: string) {
return this.service.listCommentsPublic(host, blogId);
+31
View File
@@ -381,6 +381,37 @@ export class BlogsService {
};
}
async getPublicById(host: string, blogIdRaw: string) {
const business = await this.tenant.resolveBusinessByDomain(host);
const businessId = business.id;
let blogId: bigint;
try {
blogId = BigInt(blogIdRaw);
} catch {
throw new NotFoundException('Blog post not found');
}
const blog = await this.prisma.blogs.findFirst({
where: {
business_id: businessId,
id: blogId,
status: ContentStatus.published,
},
include: blogInclude,
});
if (!blog) {
throw new NotFoundException('Blog post not found');
}
return {
blog: await this.serializeBlog(blog, {
includeComments: true,
approvedCommentsOnly: true,
}),
};
}
async listCommentsPublic(host: string, blogIdRaw: string) {
const business = await this.tenant.resolveBusinessByDomain(host);
const businessId = business.id;