File tree Expand file tree Collapse file tree 2 files changed +23
-11
lines changed
app/[locale]/(user)/publishers/[publisherSlug] Expand file tree Collapse file tree 2 files changed +23
-11
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { Metadata } from 'next';
22import { graphql } from '@/gql' ;
33
44import { GraphQL } from '@/lib/api' ;
5- import { generatePageMetadata } from '@/lib/utils' ;
5+ import { extractPublisherId , generatePageMetadata } from '@/lib/utils' ;
66import PublisherPageClient from './PublisherPageClient' ;
77
88const userInfo = graphql ( `
@@ -18,16 +18,6 @@ const userInfo = graphql(`
1818 }
1919` ) ;
2020
21- const extractPublisherId = ( publisherSlug : any ) => {
22- // If the param contains an underscore, split and take the last part
23- if ( publisherSlug . includes ( '_' ) ) {
24- return publisherSlug . split ( '_' ) . pop ( ) ;
25- }
26-
27- // Otherwise, return the param as is (it's already just the ID)
28- return publisherSlug ;
29- } ;
30-
3121export async function generateMetadata ( {
3222 params,
3323} : {
Original file line number Diff line number Diff line change 11import { Metadata } from 'next' ;
2+ import { Metadata } from 'next' ;
23import { twMerge , type ClassNameValue } from 'tailwind-merge' ;
34
45type MetadataOptions = {
@@ -148,11 +149,23 @@ export function formatDateString(
148149 )
149150 . toISOString ( )
150151 . split ( 'T' ) [ 0 ]
152+ date . toLocaleDateString ( 'en-US' , {
153+ year : 'numeric' ,
154+ month : 'numeric' ,
155+ // day: 'numeric',
156+ } )
157+ )
158+ . toISOString ( )
159+ . split ( 'T' ) [ 0 ]
151160 : date . toLocaleDateString ( 'en-US' , {
152161 month : 'long' ,
153162 // day: 'numeric',
154163 year : 'numeric' ,
155164 } ) ;
165+ month: 'long' ,
166+ // day: 'numeric',
167+ year : 'numeric' ,
168+ } ) ;
156169}
157170
158171export async function getWebsiteTitle ( url : string ) : Promise < string | null > {
@@ -256,3 +269,12 @@ export const ENTITY_CONFIG: ENTITY_CONFIG_TYPE = {
256269 priority : '0.6' ,
257270 } ,
258271} ;
272+ export const extractPublisherId = ( publisherSlug : any ) => {
273+ // If the param contains an underscore, split and take the last part
274+ if ( publisherSlug . includes ( '_' ) ) {
275+ return publisherSlug . split ( '_' ) . pop ( ) ;
276+ }
277+
278+ // Otherwise, return the param as is (it's already just the ID)
279+ return publisherSlug ;
280+ } ;
You can’t perform that action at this time.
0 commit comments