File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 11export function getPostHref ( slug : string ) {
2- // Check if the slug is already a full URL
3- if ( URL . canParse ( slug ) ) {
4- return slug ; // Return the slug as-is if it's already a URL
2+ const trimmedSlug = slug . trim ( ) ;
3+
4+ if ( URL . canParse ( trimmedSlug ) ) {
5+ return trimmedSlug ;
56 }
67
7- // Otherwise, construct the URL based on environment
8- if ( process . env . NODE_ENV === 'development' ) {
9- return `https://prosperous-combination-099461.framer.app/posts/${ slug } ` ;
8+ if ( import . meta. env . DEV ) {
9+ return `https://prosperous-combination-099461.framer.app/posts/${ trimmedSlug } ` ;
1010 }
11- return `https://leather.io/posts/${ slug } ` ;
11+
12+ return `https://leather.io/posts/${ trimmedSlug } ` ;
1213}
Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ export default defineProject({
1414 } ,
1515 test : {
1616 ...defaultVitestUnitTestingConfig . test ,
17- environment : 'jsdom' ,
1817 include : [
1918 'app/**/*.spec.{ts,tsx}' ,
2019 'app/**/*.test.{ts,tsx}' ,
You can’t perform that action at this time.
0 commit comments