-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SEO: add canonicals and change meta titles (#1960)
* add canonical link tag * change title templates * adjust title for dapps category pages * change h1 titles * Revert "adjust title for dapps category pages" This reverts commit 88ec522. * fix unit test
- Loading branch information
Showing
20 changed files
with
143 additions
and
78 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type { Route } from 'nextjs-routes'; | ||
|
||
import config from 'configs/app'; | ||
|
||
const CANONICAL_ROUTES: Array<Route['pathname']> = [ | ||
'/', | ||
'/txs', | ||
'/ops', | ||
'/verified-contracts', | ||
'/name-domains', | ||
'/withdrawals', | ||
'/tokens', | ||
'/stats', | ||
'/api-docs', | ||
'/graphiql', | ||
'/gas-tracker', | ||
'/apps', | ||
]; | ||
|
||
export default function getCanonicalUrl(pathname: Route['pathname']) { | ||
if (CANONICAL_ROUTES.includes(pathname)) { | ||
return config.app.baseUrl + pathname; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,74 @@ | ||
import type { Route } from 'nextjs-routes'; | ||
|
||
import config from 'configs/app'; | ||
|
||
const TEMPLATE_MAP: Record<Route['pathname'], string> = { | ||
'/': 'blockchain explorer', | ||
'/txs': 'transactions', | ||
'/txs/kettle/[hash]': 'kettle %hash% transactions', | ||
'/tx/[hash]': 'transaction %hash%', | ||
'/blocks': 'blocks', | ||
'/block/[height_or_hash]': 'block %height_or_hash%', | ||
'/accounts': 'top accounts', | ||
'/address/[hash]': 'address details for %hash%', | ||
'/verified-contracts': 'verified contracts', | ||
'/contract-verification': 'verify contract', | ||
'/address/[hash]/contract-verification': 'contract verification for %hash%', | ||
'/tokens': 'tokens', | ||
'/token/[hash]': 'token details', | ||
'/token/[hash]/instance/[id]': 'NFT instance', | ||
'/apps': 'apps marketplace', | ||
'/apps/[id]': 'marketplace app', | ||
'/stats': 'statistics', | ||
'/api-docs': 'REST API', | ||
'/graphiql': 'GraphQL', | ||
'/search-results': 'search result for %q%', | ||
'/auth/profile': '- my profile', | ||
'/account/watchlist': '- watchlist', | ||
'/account/api-key': '- API keys', | ||
'/account/custom-abi': '- custom ABI', | ||
'/account/tag-address': '- private tags', | ||
'/account/verified-addresses': '- my verified addresses', | ||
'/public-tags/submit': 'submit public tag', | ||
'/withdrawals': 'withdrawals', | ||
'/visualize/sol2uml': 'Solidity UML diagram', | ||
'/csv-export': 'export data to CSV', | ||
'/deposits': 'deposits (L1 > L2)', | ||
'/output-roots': 'output roots', | ||
'/dispute-games': 'dispute games', | ||
'/batches': 'tx batches (L2 blocks)', | ||
'/batches/[number]': 'L2 tx batch %number%', | ||
'/blobs/[hash]': 'blob %hash% details', | ||
'/ops': 'user operations', | ||
'/op/[hash]': 'user operation %hash%', | ||
'/404': 'error - page not found', | ||
'/name-domains': 'domains search and resolve', | ||
'/name-domains/[name]': '%name% domain details', | ||
'/validators': 'validators list', | ||
'/gas-tracker': 'gas tracker', | ||
'/': '%network_name% blockchain explorer - View %network_name% stats', | ||
'/txs': '%network_name% transactions - %network_name% explorer', | ||
'/txs/kettle/[hash]': '%network_name% kettle %hash% transactions', | ||
'/tx/[hash]': '%network_name% transaction %hash%', | ||
'/blocks': '%network_name% blocks', | ||
'/block/[height_or_hash]': '%network_name% block %height_or_hash%', | ||
'/accounts': '%network_name% top accounts', | ||
'/address/[hash]': '%network_name% address details for %hash%', | ||
'/verified-contracts': 'Verified %network_name% contracts lookup - %network_name% explorer', | ||
'/contract-verification': '%network_name% verify contract', | ||
'/address/[hash]/contract-verification': '%network_name% contract verification for %hash%', | ||
'/tokens': 'Tokens list - %network_name% explorer', | ||
'/token/[hash]': '%network_name% token details', | ||
'/token/[hash]/instance/[id]': '%network_name% NFT instance', | ||
'/apps': '%network_name% DApps - Explore top apps', | ||
'/apps/[id]': '%network_name% marketplace app', | ||
'/stats': '%network_name% stats - %network_name% network insights', | ||
'/api-docs': '%network_name% API docs - %network_name% developer tools', | ||
'/graphiql': 'GraphQL for %network_name% - %network_name% data query', | ||
'/search-results': '%network_name% search result for %q%', | ||
'/auth/profile': '%network_name% - my profile', | ||
'/account/watchlist': '%network_name% - watchlist', | ||
'/account/api-key': '%network_name% - API keys', | ||
'/account/custom-abi': '%network_name% - custom ABI', | ||
'/account/tag-address': '%network_name% - private tags', | ||
'/account/verified-addresses': '%network_name% - my verified addresses', | ||
'/public-tags/submit': '%network_name% - public tag requests', | ||
'/withdrawals': '%network_name% withdrawals - track on %network_name% explorer', | ||
'/visualize/sol2uml': '%network_name% Solidity UML diagram', | ||
'/csv-export': '%network_name% export data to CSV', | ||
'/deposits': '%network_name% deposits (L1 > L2)', | ||
'/output-roots': '%network_name% output roots', | ||
'/dispute-games': '%network_name% dispute games', | ||
'/batches': '%network_name% tx batches (L2 blocks)', | ||
'/batches/[number]': '%network_name% L2 tx batch %number%', | ||
'/blobs/[hash]': '%network_name% blob %hash% details', | ||
'/ops': 'User operations on %network_name% - %network_name% explorer', | ||
'/op/[hash]': '%network_name% user operation %hash%', | ||
'/404': '%network_name% error - page not found', | ||
'/name-domains': '%network_name% name domains - %network_name% explorer', | ||
'/name-domains/[name]': '%network_name% %name% domain details', | ||
'/validators': '%network_name% validators list', | ||
'/gas-tracker': '%network_name% gas tracker - Current gas fees', | ||
|
||
// service routes, added only to make typescript happy | ||
'/login': 'login', | ||
'/api/metrics': 'node API prometheus metrics', | ||
'/api/log': 'node API request log', | ||
'/api/media-type': 'node API media type', | ||
'/api/proxy': 'node API proxy', | ||
'/api/csrf': 'node API CSRF token', | ||
'/api/healthz': 'node API health check', | ||
'/auth/auth0': 'authentication', | ||
'/auth/unverified-email': 'unverified email', | ||
'/login': '%network_name% login', | ||
'/api/metrics': '%network_name% node API prometheus metrics', | ||
'/api/log': '%network_name% node API request log', | ||
'/api/media-type': '%network_name% node API media type', | ||
'/api/proxy': '%network_name% node API proxy', | ||
'/api/csrf': '%network_name% node API CSRF token', | ||
'/api/healthz': '%network_name% node API health check', | ||
'/auth/auth0': '%network_name% authentication', | ||
'/auth/unverified-email': '%network_name% unverified email', | ||
}; | ||
|
||
const TEMPLATE_MAP_ENHANCED: Partial<Record<Route['pathname'], string>> = { | ||
'/token/[hash]': '%symbol% token details', | ||
'/token/[hash]/instance/[id]': 'token instance for %symbol%', | ||
'/apps/[id]': '- %app_name%', | ||
'/address/[hash]': 'address details for %domain_name%', | ||
'/token/[hash]': '%network_name% %symbol% token details', | ||
'/token/[hash]/instance/[id]': '%network_name% token instance for %symbol%', | ||
'/apps/[id]': '%network_name% - %app_name%', | ||
'/address/[hash]': '%network_name% address details for %domain_name%', | ||
}; | ||
|
||
export function make(pathname: Route['pathname'], isEnriched = false) { | ||
const template = (isEnriched ? TEMPLATE_MAP_ENHANCED[pathname] : undefined) ?? TEMPLATE_MAP[pathname]; | ||
const postfix = config.meta.promoteBlockscoutInTitle ? ' | Blockscout' : ''; | ||
|
||
return `%network_name% ${ template }`; | ||
return (template + postfix).trim(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,5 @@ export interface Metadata { | |
description?: string; | ||
imageUrl?: string; | ||
}; | ||
canonical: string | undefined; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.