SEO/AEO, Farb schema, breadcrumbs
This commit is contained in:
51
bizmatch-server/src/sitemap/sitemap.controller.ts
Normal file
51
bizmatch-server/src/sitemap/sitemap.controller.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import { Controller, Get, Header, Param, ParseIntPipe } from '@nestjs/common';
|
||||
import { SitemapService } from './sitemap.service';
|
||||
|
||||
@Controller()
|
||||
export class SitemapController {
|
||||
constructor(private readonly sitemapService: SitemapService) {}
|
||||
|
||||
/**
|
||||
* Main sitemap index - lists all sitemap files
|
||||
* Route: /sitemap.xml
|
||||
*/
|
||||
@Get('sitemap.xml')
|
||||
@Header('Content-Type', 'application/xml')
|
||||
@Header('Cache-Control', 'public, max-age=3600')
|
||||
async getSitemapIndex(): Promise<string> {
|
||||
return await this.sitemapService.generateSitemapIndex();
|
||||
}
|
||||
|
||||
/**
|
||||
* Static pages sitemap
|
||||
* Route: /sitemap/static.xml
|
||||
*/
|
||||
@Get('sitemap/static.xml')
|
||||
@Header('Content-Type', 'application/xml')
|
||||
@Header('Cache-Control', 'public, max-age=3600')
|
||||
async getStaticSitemap(): Promise<string> {
|
||||
return await this.sitemapService.generateStaticSitemap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Business listings sitemap (paginated)
|
||||
* Route: /sitemap/business-1.xml, /sitemap/business-2.xml, etc.
|
||||
*/
|
||||
@Get('sitemap/business-:page.xml')
|
||||
@Header('Content-Type', 'application/xml')
|
||||
@Header('Cache-Control', 'public, max-age=3600')
|
||||
async getBusinessSitemap(@Param('page', ParseIntPipe) page: number): Promise<string> {
|
||||
return await this.sitemapService.generateBusinessSitemap(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* Commercial property sitemap (paginated)
|
||||
* Route: /sitemap/commercial-1.xml, /sitemap/commercial-2.xml, etc.
|
||||
*/
|
||||
@Get('sitemap/commercial-:page.xml')
|
||||
@Header('Content-Type', 'application/xml')
|
||||
@Header('Cache-Control', 'public, max-age=3600')
|
||||
async getCommercialSitemap(@Param('page', ParseIntPipe) page: number): Promise<string> {
|
||||
return await this.sitemapService.generateCommercialSitemap(page);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user