diff --git a/packages/backend/src/server/web/ClientServerService.ts b/packages/backend/src/server/web/ClientServerService.ts index c6788dce93ac..f35ec8ba31ca 100644 --- a/packages/backend/src/server/web/ClientServerService.ts +++ b/packages/backend/src/server/web/ClientServerService.ts @@ -438,7 +438,7 @@ export class ClientServerService { //#endregion - const renderBase = async (reply: FastifyReply) => { + const renderBase = async (reply: FastifyReply, data: { [key: string]: any } = {}) => { const meta = await this.metaService.fetch(); reply.header('Cache-Control', 'public, max-age=30'); return await reply.view('base', { @@ -447,6 +447,7 @@ export class ClientServerService { title: meta.name ?? 'Misskey', desc: meta.description, ...await this.generateCommonPugData(meta), + ...data, }); }; @@ -745,26 +746,14 @@ export class ClientServerService { //#endregion //region noindex pages - const renderNoIndexBase = async (reply: FastifyReply) => { - const meta = await this.metaService.fetch(); - reply.header('Cache-Control', 'public, max-age=30'); - return await reply.view('noindex', { - img: meta.bannerUrl, - url: this.config.url, - title: meta.name ?? 'Misskey', - desc: meta.description, - ...await this.generateCommonPugData(meta), - }); - }; - // Tags fastify.get<{ Params: { clip: string; } }>('/tags/:tag', async (request, reply) => { - return await renderNoIndexBase(reply); + return await renderBase(reply, { noindex: true }); }); // User with Tags fastify.get<{ Params: { clip: string; } }>('/user-tags/:tag', async (request, reply) => { - return await renderNoIndexBase(reply); + return await renderBase(reply, { noindex: true }); }); //endregion diff --git a/packages/backend/src/server/web/views/base.pug b/packages/backend/src/server/web/views/base.pug index 1d9146e22a37..ec1325e4e97f 100644 --- a/packages/backend/src/server/web/views/base.pug +++ b/packages/backend/src/server/web/views/base.pug @@ -50,6 +50,9 @@ html block title = title || 'Misskey' + if noindex + meta(name='robots' content='noindex') + block desc meta(name='description' content= desc || '✨🌎✨ A interplanetary communication platform ✨🚀✨') diff --git a/packages/backend/src/server/web/views/noindex.pug b/packages/backend/src/server/web/views/noindex.pug deleted file mode 100644 index 50cda2bbc944..000000000000 --- a/packages/backend/src/server/web/views/noindex.pug +++ /dev/null @@ -1,5 +0,0 @@ -extends ./base - -block meta - //- follow is allowed, but this tags page does not have any own content so noindex - meta(name='robots' content='noindex')