gridsome.org icon indicating copy to clipboard operation
gridsome.org copied to clipboard

Gridsome workflow pages names & props

Open wallythewebdev opened this issue 5 years ago • 3 comments
trafficstars

HI Guys,

I've been playing around with Gridsome and have come to a fork in the road which from the Docs I have not found a solid / clear answer - maybe its implied, but not stated (or possibly I am being an idiot - this is also common)

Girdsome page names:

Can you set a page name to a page in gridsome? i.e.

image

Why is this needed:

On the user clicking a component I use this.$router.push(name: X, props: { X: X}) to change the page I pass an object as a prop to the new page I did try to use the pages PATH instead of the name but it was unable to pass the prop when doing so

I can add the name manually to the routers.js file in the .temp folder - however if I add a new page - this is then wiped

Am I not using gridsome as it should have been intended? is there a way to add a name to a route?


Passing data to different pages

The above question has seemed from me needing to pass an object with data to different pages as a prop - but gridsome used GraphQL so is it intended that you use GraphQL on each page to get the data for that page and instead should not pass variables?


Any help on clarifying this would be great - Thanks in advance - W

wallythewebdev avatar Oct 30 '20 08:10 wallythewebdev

@wallythewebdev This is not (perhaps yet) possible in Gridsome, no. There is an open issue about this: https://github.com/gridsome/gridsome/issues/756

I realise this is a bit late to answer, but just for future reference the Gridsome discord community is a bit more active, and you may get a answer quicker there!

travis-r6s avatar Jan 21 '21 12:01 travis-r6s

Hi there -

Thanks for the reply. I'll keep and eye on the issue and thanks for the tip on the discord.

wallythewebdev avatar Jan 21 '21 13:01 wallythewebdev

Here's a solution for anybody still looking :100:

camwhite avatar Jun 03 '21 20:06 camwhite