Is it possible for +server.ts to get data from +page.ts? #8362
Unanswered
winston0410
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have seen this ticket, and I am having metadata in page level and generating the metadata in Layout solved the metadata issue gracefully.
And I realized that those data is useful for building a sitemap as well. I tried to put a
metadata.ts
file next to every+page.svelte
in a function(so that it can be static, or dynamic by fetching from an external api)And generate them in
sitemap.xml/+server.ts
At this point I realized that what I am doing is to get data from
+page.ts
to+server.ts
. Is there a better way to achieve what I am doing right now?Beta Was this translation helpful? Give feedback.
All reactions