mirror of
https://github.com/mempool/mempool.git
synced 2025-02-24 14:50:52 +01:00
Add meta descriptions to docs page
Also move all meta tag setting to ngDoCheck() because page titles were not updating when user switched docs tabs.
This commit is contained in:
parent
d42a3f74ec
commit
d1f26f0491
1 changed files with 34 additions and 15 deletions
|
@ -28,21 +28,6 @@ export class DocsComponent implements OnInit {
|
|||
|
||||
ngOnInit(): void {
|
||||
this.websocket.want(['blocks']);
|
||||
const url = this.route.snapshot.url;
|
||||
if (url[0].path === "faq" ) {
|
||||
this.activeTab = 0;
|
||||
this.seoService.setTitle($localize`:@@docs.faq.button-title:FAQ`);
|
||||
} else if( url[1].path === "rest" ) {
|
||||
this.activeTab = 1;
|
||||
this.seoService.setTitle($localize`:@@e351b40b3869a5c7d19c3d4918cb1ac7aaab95c4:API`);
|
||||
} else if( url[1].path === "websocket" ) {
|
||||
this.activeTab = 2;
|
||||
this.seoService.setTitle($localize`:@@e351b40b3869a5c7d19c3d4918cb1ac7aaab95c4:API`);
|
||||
} else {
|
||||
this.activeTab = 3;
|
||||
this.seoService.setTitle($localize`:@@e351b40b3869a5c7d19c3d4918cb1ac7aaab95c4:API`);
|
||||
}
|
||||
|
||||
this.env = this.stateService.env;
|
||||
this.showWebSocketTab = ( ! ( ( this.stateService.network === "bisq" ) || ( this.stateService.network === "liquidtestnet" ) ) );
|
||||
this.showFaqTab = ( this.env.BASE_MODULE === 'mempool' ) ? true : false;
|
||||
|
@ -51,6 +36,40 @@ export class DocsComponent implements OnInit {
|
|||
document.querySelector<HTMLElement>( "html" ).style.scrollBehavior = "smooth";
|
||||
}
|
||||
|
||||
ngDoCheck(): void {
|
||||
|
||||
const url = this.route.snapshot.url;
|
||||
|
||||
if (url[0].path === "faq" ) {
|
||||
this.activeTab = 0;
|
||||
this.seoService.setTitle($localize`:@@meta.title.docs.faq:FAQ`);
|
||||
this.seoService.setDescription($localize`:@@meta.description.docs.faq:Get answers to common questions like: What is a mempool? Why isn't my transaction confirming? How can I run my own instance of The Mempool Open Source Project? And more.`);
|
||||
} else if( url[1].path === "rest" ) {
|
||||
this.activeTab = 1;
|
||||
this.seoService.setTitle($localize`:@@meta.title.docs.rest:REST API`);
|
||||
if( this.stateService.network === 'liquid' || this.stateService.network === 'liquidtestnet' ) {
|
||||
this.seoService.setDescription($localize`:@@meta.description.docs.rest-liquid:Documentation for the liquid.network REST API service: get info on addresses, transactions, assets, blocks, and more.`);
|
||||
} else if( this.stateService.network === 'bisq' ) {
|
||||
this.seoService.setDescription($localize`:@@meta.description.docs.rest-bisq:Documentation for the bisq.markets REST API service: get info on recent trades, current offers, transactions, network state, and more.`);
|
||||
} else {
|
||||
this.seoService.setDescription($localize`:@@meta.description.docs.rest-bitcoin:Documentation for the mempool.space REST API service: get info on addresses, transactions, blocks, fees, mining, the Lightning network, and more.`);
|
||||
}
|
||||
} else if( url[1].path === "websocket" ) {
|
||||
this.activeTab = 2;
|
||||
this.seoService.setTitle($localize`:@@meta.title.docs.websocket:WebSocket API`);
|
||||
if( this.stateService.network === 'liquid' || this.stateService.network === 'liquidtestnet' ) {
|
||||
this.seoService.setDescription($localize`:@@meta.description.docs.websocket-liquid:Documentation for the liquid.network WebSocket API service: get real-time info on blocks, mempools, transactions, addresses, and more.`);
|
||||
} else {
|
||||
this.seoService.setDescription($localize`:@@meta.description.docs.websocket-bitcoin:Documentation for the mempool.space WebSocket API service: get real-time info on blocks, mempools, transactions, addresses, and more.`);
|
||||
}
|
||||
} else {
|
||||
this.activeTab = 3;
|
||||
this.seoService.setTitle($localize`:@@meta.title.docs.websocket:Electrum RPC`);
|
||||
this.seoService.setDescription($localize`:@@meta.description.docs.electrumrpc:Documentation for our Electrum RPC interface: get instant, convenient, and reliable access to an Esplora instance.`);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
document.querySelector<HTMLElement>( "html" ).style.scrollBehavior = "auto";
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue