mirror of
https://github.com/mempool/mempool.git
synced 2025-04-10 21:09:30 +02:00
Add open graph link titles
This commit is contained in:
parent
a67c0b166c
commit
d1ad9efe64
@ -20,13 +20,13 @@ export class SeoService {
|
||||
setTitle(newTitle: string): void {
|
||||
this.titleService.setTitle(newTitle + ' - ' + this.getTitle());
|
||||
this.metaService.updateTag({ property: 'og:title', content: newTitle});
|
||||
this.metaService.updateTag({ property: 'twitter:description', content: newTitle});
|
||||
this.metaService.updateTag({ property: 'twitter:title', content: newTitle});
|
||||
}
|
||||
|
||||
resetTitle(): void {
|
||||
this.titleService.setTitle(this.getTitle());
|
||||
this.metaService.updateTag({ property: 'og:title', content: this.getTitle()});
|
||||
this.metaService.updateTag({ property: 'twitter:description', content: this.getTitle()});
|
||||
this.metaService.updateTag({ property: 'twitter:title', content: this.getTitle()});
|
||||
}
|
||||
|
||||
setEnterpriseTitle(title: string) {
|
||||
|
@ -76,6 +76,11 @@ class Server {
|
||||
return page.screenshot();
|
||||
} break;
|
||||
default: {
|
||||
try {
|
||||
await page.waitForSelector('meta[property="og:title"', { timeout: 5000 })
|
||||
} catch (e) {
|
||||
// probably timed out
|
||||
}
|
||||
return page.content();
|
||||
}
|
||||
}
|
||||
@ -96,6 +101,14 @@ class Server {
|
||||
}
|
||||
|
||||
async renderHTML(req, res) {
|
||||
// drop requests for static files
|
||||
const path = req.params[0];
|
||||
const match = path.match(/\.[\w]+$/);
|
||||
if (match?.length && match[0] !== '.html') {
|
||||
res.status(404).send();
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
let html = await this.cluster?.execute({ url: this.mempoolHost + req.params[0], action: 'html' });
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user