#How to use Bootstrap in SSG website

38 messages · Page 1 of 1 (latest)

pseudo current
#

I have blog listing website where I build using Next js SSG. I did installed the bootstrap and used it. it is working fine when i runs it locally. but when I create build using output: "export" for SSG website. but when I try to open the html pages of out/dist directory. the bootstrap breaks and site is not showing as it should be.

example: abc/blog is working fine but abc/blog/1212 is not working as expected.

hollow masonBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

pseudo current
#

here is the structure.

I have my import of bootstrao in app > layout.js

delicate night
#

there are two versions

pseudo current
#

Here are the screenshots

delicate night
#

oh

#

u dont need to do that

#

check this

pseudo current
#

do you mean i should use Script?

delicate night
#

yup

pseudo current
#

okay, and also will it work in SSG?

delicate night
#

yes

#

since its a bundle u can directly offload your bootstrap script to a cdn

#

nextjs will load that for u

#

before page gets rendered

#

but u have options to customize the behaviour

pseudo current
#

The issue is this, When I directly hit this page. it broke

delicate night
pseudo current
delicate night
#

oh that will not work for local scripts

pseudo current
#

let me check

#

is this correct ?

delicate night
#

looks g ood

pseudo current
#

still same

delicate night
#

check in browser console

#

if the script gets loaded

pseudo current
delicate night
#

uhm that doesnt look healthy

#

u might need to take care of the other errors first

pseudo current
#

these only comes when i directly hit From URL

#

assetPrefix: "./",

issue is due to this

#

due to the assetPrefix the issue is coming, in next.config.js

pseudo current
#

I have added assetsPrefix path as my domain name and it worked.