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 {
|
setTitle(newTitle: string): void {
|
||||||
this.titleService.setTitle(newTitle + ' - ' + this.getTitle());
|
this.titleService.setTitle(newTitle + ' - ' + this.getTitle());
|
||||||
this.metaService.updateTag({ property: 'og:title', content: newTitle});
|
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 {
|
resetTitle(): void {
|
||||||
this.titleService.setTitle(this.getTitle());
|
this.titleService.setTitle(this.getTitle());
|
||||||
this.metaService.updateTag({ property: 'og:title', content: 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) {
|
setEnterpriseTitle(title: string) {
|
||||||
|
@ -76,6 +76,11 @@ class Server {
|
|||||||
return page.screenshot();
|
return page.screenshot();
|
||||||
} break;
|
} break;
|
||||||
default: {
|
default: {
|
||||||
|
try {
|
||||||
|
await page.waitForSelector('meta[property="og:title"', { timeout: 5000 })
|
||||||
|
} catch (e) {
|
||||||
|
// probably timed out
|
||||||
|
}
|
||||||
return page.content();
|
return page.content();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,6 +101,14 @@ class Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async renderHTML(req, res) {
|
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 {
|
try {
|
||||||
let html = await this.cluster?.execute({ url: this.mempoolHost + req.params[0], action: 'html' });
|
let html = await this.cluster?.execute({ url: this.mempoolHost + req.params[0], action: 'html' });
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user