#Access content collection frontmatter of individual post

18 messages · Page 1 of 1 (latest)

sharp pivot
#

@rustic path

Can you show the whole file you're working with including the frontmatter at top

rustic path
#

Yes, give me a moment

sharp pivot
#

can you share the console log that should print in your terminal when you go to that route

rustic path
#

Just a second 🙂

#

As i said, im a student, sorry.
If i understand correctly, the console log is in the web browser. How can i acces it when it just redirects me to an error page ?

little dirge
#

It would be in your console output where you ran npm run dev

rustic path
#

24:46:06 [ERROR] Article is not defined
Stack trace:
at eval (eval at instantiateModule (file:///Users/vedadtr/Desktop/%20astronovi/node_modules/vite/dist/node/chunks/dep-G-px366b.js:54755:28), <anonymous>:14:1843)
[...] See full stack trace in the browser, or rerun with --verbose.

#

Is this what youre looking for ?

little dirge
#

So here <p class="text-sm text-[#222222]">By: {Article.data.author}, </p> this is where the error is. I believe here you want <p class="text-sm text-[#222222]">By: {post.data.author}, </p>

sharp pivot
#

no worries and yeah hunter is right in your terminal where ever you started the dev server either bottom of vscode or terminal app but yeah on line 24

rustic path
#

Oh god it worked

little dirge
#

There ya go!

rustic path
#

Thank you man so much

little dirge
#

Sure thing. Any time

rustic path
#

Care to explain what was the error ?

little dirge
#

Sure. In your front matter, you were fetching your data and assigning to a variable called post but in your JSX. You were using Article which was not declared.