You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to display single post, I've created a SinglePost.vue, add object into /router/index.js
{
// How to dynamic detect the path?
path: '/:slug',
component: SinglePost
}
Right now I'm cheating, he he, change the permalink into "postname" only, to make it easy.
My question is, in WP we have many ways to display the path, from date /2017/10/18/hello-world, to category like /cagegory/hello-world, how could we get it and put it into the path programmatically?
Thanks.
The text was updated successfully, but these errors were encountered:
For each post you're going to get the slug as part of the post object. For your link to that post you'll want to do a <router-link :to="'/posts/'+post.slug"></router-link>
Then in your router you would do:
{
// How to dynamic detect the path?
path: '/posts/:slug',
component: SinglePost
}
One of the costs of replacing the WordPress theme with a Vue app is that we lose access to some of those handy WordPress functions, unless of course we leverage those to modify the JSON response from the API.
Hi Evan,
I'm trying to display single post, I've created a SinglePost.vue, add object into
/router/index.js
Right now I'm cheating, he he, change the permalink into "postname" only, to make it easy.
My question is, in WP we have many ways to display the path, from date
/2017/10/18/hello-world
, to category like/cagegory/hello-world
, how could we get it and put it into thepath
programmatically?Thanks.
The text was updated successfully, but these errors were encountered: