Skip to content

Commit

Permalink
fix: apply trailingSlash config to NuxtLink component
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Jan 11, 2024
1 parent 145f416 commit 1879310
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
useLogger,
} from '@nuxt/kit'
import chalk from 'chalk'
import { installNuxtSiteConfig } from 'nuxt-site-config-kit'
import { installNuxtSiteConfig, useSiteConfig } from 'nuxt-site-config-kit'
import { readPackageJSON } from 'pkg-types'

export interface ModuleOptions {
Expand Down Expand Up @@ -127,6 +127,10 @@ export default defineNuxtModule<ModuleOptions>({
name: 'useBreadcrumbItems',
})

const siteConfig = useSiteConfig()
if (nuxt.options.experimental?.defaults?.nuxtLink && typeof nuxt.options.experimental?.defaults?.nuxtLink?.trailingSlash == 'undefined')
nuxt.options.experimental.defaults.nuxtLink.trailingSlash = siteConfig.trailingSlash ? 'append' : 'remove'

// if user disables certain modules we need to pollyfill the imports
const polyfills: Record<string, string[]> = {
schemaOrg: ['useSchemaOrg', 'defineWebSite', 'defineWebPage'],
Expand Down

0 comments on commit 1879310

Please sign in to comment.