Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prismic instead of axios? #94

Open
asencis opened this issue Feb 4, 2021 · 2 comments
Open

Prismic instead of axios? #94

asencis opened this issue Feb 4, 2021 · 2 comments

Comments

@asencis
Copy link

asencis commented Feb 4, 2021

Does anyone have a solution for using $primsic (the official nuxt plugin version) with the async create (feed) {} call?

@olvap
Copy link

olvap commented Jun 11, 2021

Did you found a solution for this?

@haghdk
Copy link

haghdk commented Oct 6, 2021

I made it work with this in my nuxt.config.js

import Prismic from '@prismicio/client'

feed: [
    // A default feed configuration object
    {
      path: '/feed.xml',
      async create(feed) {
        feed.options = {
          title: 'My Title',
          link: 'https://www.domain.com/feed.xml',
          description: 'My description',
        }

        const api = await Prismic.getApi('https://domain.cdn.prismic.io/api/v2')
        const blogposts = await api.query(Prismic.Predicates.at('document.type', 'blogpost'))

        blogposts.results.forEach((post) => {
          feed.addItem({
            title: post.data.meta_title,
            id: `https://www.domain.com/${post.uid}/`,
            link: `https://www.domain.com/${post.uid}/`,
            description: post.data.meta_description,
            date: new Date(post.data.post_date),
          })
        })
      },
      cacheTime: 1000 * 60 * 15,
      type: 'rss2',
    },
  ],

@NozomuIkuta NozomuIkuta mentioned this issue Jul 21, 2022
28 tasks
@NozomuIkuta NozomuIkuta mentioned this issue Dec 14, 2022
21 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants