Rju
Rju

Reputation: 63

How to route to my posts internally with nuxt

Trying to pass internal links in my template, but it does not direct to the links.

<nuxt-link
              to="blog.url"
              >{{ blog.title }} by {{ blog.author }}</nuxt-link
            >

And in my data I have this (where blog.title and blog.author correctly work)

data() {
    return {
      blog: [
        { url: '/blog1', title: 'my first title', author: 'Brad' },
        { url: '/blog2', title: 'my second title', author: 'James' },
        { url: '/blog3', title: 'my third title', author: 'Tom' }
]
}
}

The output from the nuxt-link is simply "blog.url" and does not route anywhere. How to make it route to my internal links specified per blog1, blog2, blog3?

Upvotes: 0

Views: 63

Answers (1)

Nick Dawes
Nick Dawes

Reputation: 2244

You want :to, not to. Without the colon, you’re pointing to the string “blog.url”, not your data.

Upvotes: 1

Related Questions