N
Nuxt8mo ago
Insight

Static Site global object

Hello, I am somewhat new to nuxt. I used nuxt ages ago in v1 but it has been a while. I am trying to make a static site and want to have a yml or json file which contains some basic information like phone number and email and then load it into the page so you only have to change one location if you want update the phone number/email etc. I am currently using Nuxt3.
5 Replies
Insight
InsightOP8mo ago
For single pages I am just using import questions from '~/static/data/faq.json' to load data but wondering if there is a better more standard way to do it in nuxt
manniL
manniL8mo ago
I’d create an API endpoint in nitro and prerender that I think ☺️
Insight
InsightOP8mo ago
hmm any beginning point for that you would recommend to learn it? and would that work with nuxt generate static sites?
manniL
manniL8mo ago
Yes because you prerender the endpoint too 👌🏻 The nuxt and nitro docs
Insight
InsightOP8mo ago
@manniL / TheAlexLichter Wouldn't that still make it so I would have to query it on any component? I guess I was looking for more of a way to load it once and be able to access "site" data from any page/component using a global variable or something
Want results from more Discord servers?
Add your server