From 92bf2f62995bbaa0402cb4657473ad8d5b6fcf8d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 21 Feb 2019 14:06:10 +0100 Subject: Improve channel and account SEO --- server/controllers/client.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'server/controllers') diff --git a/server/controllers/client.ts b/server/controllers/client.ts index f17f2a5d2..ece2f460c 100644 --- a/server/controllers/client.ts +++ b/server/controllers/client.ts @@ -17,6 +17,8 @@ const testEmbedPath = join(distPath, 'standalone', 'videos', 'test-embed.html') // Special route that add OpenGraph and oEmbed tags // Do not use a template engine for a so little thing clientsRouter.use('/videos/watch/:id', asyncMiddleware(generateWatchHtmlPage)) +clientsRouter.use('/accounts/:nameWithHost', asyncMiddleware(generateAccountHtmlPage)) +clientsRouter.use('/video-channels/:nameWithHost', asyncMiddleware(generateVideoChannelHtmlPage)) clientsRouter.use( '/videos/embed', @@ -99,6 +101,18 @@ async function generateWatchHtmlPage (req: express.Request, res: express.Respons return sendHTML(html, res) } +async function generateAccountHtmlPage (req: express.Request, res: express.Response) { + const html = await ClientHtml.getAccountHTMLPage(req.params.nameWithHost, req, res) + + return sendHTML(html, res) +} + +async function generateVideoChannelHtmlPage (req: express.Request, res: express.Response) { + const html = await ClientHtml.getVideoChannelHTMLPage(req.params.nameWithHost, req, res) + + return sendHTML(html, res) +} + function sendHTML (html: string, res: express.Response) { res.set('Content-Type', 'text/html; charset=UTF-8') -- cgit v1.2.3