@@ -11,16 +11,9 @@ import * as types from '@/typedefs/blockchain';
1111import { RiCloseLine } from 'react-icons/ri' ;
1212import { isAddress } from 'viem' ;
1313
14- const errorMetadata = {
15- title : 'Error' ,
16- openGraph : {
17- title : 'Error' ,
18- } ,
19- } ;
20-
21- const resolveNodeEthAddress = ( nodeAddress ?: string ) : types . EthAddress | null => {
22- if ( ! nodeAddress ) {
23- return null ;
14+ const resolveNodeEthAddress = ( nodeAddress ?: string ) : types . EthAddress | null => {
15+ if ( ! nodeAddress ) {
16+ return null ;
2417 }
2518
2619 if ( nodeAddress . startsWith ( '0xai_' ) ) {
@@ -39,12 +32,22 @@ const resolveNodeEthAddress = (nodeAddress?: string): types.EthAddress | null =>
3932 return nodeAddress ;
4033} ;
4134
42- export async function generateMetadata ( { params } ) {
43- const { nodeAddr } = await params ;
44- const resolvedNodeEthAddr = resolveNodeEthAddress ( nodeAddr ) ;
45-
46- if ( ! resolvedNodeEthAddr ) {
47- console . log ( `[Node Page] Invalid node address: ${ nodeAddr } ` ) ;
35+ export async function generateMetadata ( { params } ) {
36+ const { nodeAddr } = await params ;
37+ const canonical = `/node/${ encodeURIComponent ( nodeAddr ) } ` ;
38+ const errorMetadata = {
39+ title : 'Error' ,
40+ openGraph : {
41+ title : 'Error' ,
42+ } ,
43+ alternates : {
44+ canonical,
45+ } ,
46+ } ;
47+ const resolvedNodeEthAddr = resolveNodeEthAddress ( nodeAddr ) ;
48+
49+ if ( ! resolvedNodeEthAddr ) {
50+ console . log ( `[Node Page] Invalid node address: ${ nodeAddr } ` ) ;
4851 return errorMetadata ;
4952 }
5053
@@ -57,13 +60,16 @@ export async function generateMetadata({ params }) {
5760 return errorMetadata ;
5861 }
5962
60- return {
61- title : `Node • ${ nodeResponse . node_alias } ` ,
62- openGraph : {
63- title : `Node • ${ nodeResponse . node_alias } ` ,
64- } ,
65- } ;
66- }
63+ return {
64+ title : `Node • ${ nodeResponse . node_alias } ` ,
65+ openGraph : {
66+ title : `Node • ${ nodeResponse . node_alias } ` ,
67+ } ,
68+ alternates : {
69+ canonical,
70+ } ,
71+ } ;
72+ }
6773
6874const fetchLicenseDetailsAndNodeAvailability = async (
6975 nodeEthAddr : types . EthAddress ,
0 commit comments