Merge pull request #4200 from mempool/mononaut/canonical-blocks
Update canonical link with block hash
This commit is contained in:
commit
d0696628b2
@ -69,6 +69,7 @@ export class BisqBlockComponent implements OnInit, OnDestroy {
|
|||||||
this.location.replaceState(
|
this.location.replaceState(
|
||||||
this.router.createUrlTree(['/bisq/block/', hash]).toString()
|
this.router.createUrlTree(['/bisq/block/', hash]).toString()
|
||||||
);
|
);
|
||||||
|
this.seoService.updateCanonical(this.location.path());
|
||||||
return this.bisqApiService.getBlock$(this.blockHash)
|
return this.bisqApiService.getBlock$(this.blockHash)
|
||||||
.pipe(catchError(this.caughtHttpError.bind(this)));
|
.pipe(catchError(this.caughtHttpError.bind(this)));
|
||||||
}),
|
}),
|
||||||
|
@ -202,6 +202,7 @@ export class BlockComponent implements OnInit, OnDestroy {
|
|||||||
this.location.replaceState(
|
this.location.replaceState(
|
||||||
this.router.createUrlTree([(this.network ? '/' + this.network : '') + '/block/', hash]).toString()
|
this.router.createUrlTree([(this.network ? '/' + this.network : '') + '/block/', hash]).toString()
|
||||||
);
|
);
|
||||||
|
this.seoService.updateCanonical(this.location.path());
|
||||||
return this.apiService.getBlock$(hash).pipe(
|
return this.apiService.getBlock$(hash).pipe(
|
||||||
catchError((err) => {
|
catchError((err) => {
|
||||||
this.error = err;
|
this.error = err;
|
||||||
|
@ -12,6 +12,8 @@ export class SeoService {
|
|||||||
baseTitle = 'mempool';
|
baseTitle = 'mempool';
|
||||||
baseDescription = 'Explore the full Bitcoin ecosystem with The Mempool Open Project™.';
|
baseDescription = 'Explore the full Bitcoin ecosystem with The Mempool Open Project™.';
|
||||||
|
|
||||||
|
canonicalLink: HTMLElement = document.getElementById('canonical');
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private titleService: Title,
|
private titleService: Title,
|
||||||
private metaService: Meta,
|
private metaService: Meta,
|
||||||
@ -65,6 +67,16 @@ export class SeoService {
|
|||||||
this.metaService.updateTag({ property: 'og:description', content: this.getDescription()});
|
this.metaService.updateTag({ property: 'og:description', content: this.getDescription()});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateCanonical(path) {
|
||||||
|
let domain = 'mempool.space';
|
||||||
|
if (this.stateService.env.BASE_MODULE === 'liquid') {
|
||||||
|
domain = 'liquid.network';
|
||||||
|
} else if (this.stateService.env.BASE_MODULE === 'bisq') {
|
||||||
|
domain = 'bisq.markets';
|
||||||
|
}
|
||||||
|
this.canonicalLink.setAttribute('href', 'https://' + domain + path);
|
||||||
|
}
|
||||||
|
|
||||||
getTitle(): string {
|
getTitle(): string {
|
||||||
if (this.network === 'testnet')
|
if (this.network === 'testnet')
|
||||||
return this.baseTitle + ' - Bitcoin Testnet';
|
return this.baseTitle + ' - Bitcoin Testnet';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user