Nuxt Content + trailingSlash: Links to Static Files Return 404 - Problem and Solution

Overview In a Nuxt 3/4 + Nuxt Content environment with trailingSlash: "append" configured, links to static files such as PDFs and images within content may result in 404 errors. Conditions for Occurrence This occurs when all of the following conditions are met: Using Nuxt 3/4 + Nuxt Content trailingSlash: "append" is set in nuxt.config.ts There are links to static files (PDFs, images, etc.) in Markdown or content Problem Details Symptoms When writing a link like the following in content: ...

February 4, 2026 · 8 min · Nakamura

How to Properly Load Local JSON Files in Nuxt 4 SSG

Introduction When performing Static Site Generation (SSG) with Nuxt 4, you may want to load data from local JSON files to generate static pages. However, it is not as simple as Next.js’s getStaticProps, and there are several pitfalls to be aware of. This article introduces the correct approach discovered through trial and error. Problem: Why Simple fs Reading Doesn’t Work First Approach (Failed) c } o ; n i } c r ❌ s f o e t c c c c r n t T ( o o o o e C s u h f i n n n n t l t r i e m s s s s u i n s t p t t t t r e r c o n n e a d h r f p f d t s w o L t s a u a J p a e o . t l t S s o i s c m = h l a O i n t n a e P N d s ' l t a = a = . e e r t D a w t p e a . a a h f a = s w t s i w s r p o a e t a = . s a o r r i r e w n k = v i t p e ( a s e m a a d i e a r p i t d a t . s ) o m h F t j y r p . i a f s n { t o r l ) e o c ( r e e ; t n ' t s S c ( ( f ( o y h ) f s ' l n ( ; i ' p v c ` l ) a e ( / e ; t ( f d P h p u a a ' r l t t ) o l a h ; c P / : e a $ s t { s s h f t . , i r c l i w ' e n d u P g ( t a ) ) f t , - h = 8 } > ' ' ` p ) ) { u ; ; b l i c / d a t a ' , f i l e P a t h ) ; This approach has the following problems: ...

December 11, 2025 · 22 min · Nakamura