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

integration with strapi? #159

Open
hrahimi270 opened this issue Nov 18, 2020 · 0 comments
Open

integration with strapi? #159

hrahimi270 opened this issue Nov 18, 2020 · 0 comments

Comments

@hrahimi270
Copy link

Hi there.
I'm using Strapi as my CMS. Also, I used your plugin for my static pages and works fine for me.
But, there are some dynamic pages that I create them using the createPage action. These pages are coming from Strapi API. How can I handle multilingual functionality for these dynamic pages?

Currently, I create a page for both my languages manually. I mean, using createPage twice in a loop with different paths for languages. But I think there should be a better way to do it. Right?

const services = result.data.allStrapiServices.edges;
  services.forEach((service) => {
    createPage({
      path: service.node.slug,
      component: ServiceTemplate,
      context: {
        slug: service.node.slug,
      },
    })

    createPage({
      path: '/fa/' + service.node.slug,
      component: ServiceTemplate,
      context: {
        slug: service.node.slug,
      },
    })
  })

Also, In my page component, I need to recognize which language that page is to handle some UI stuff.

I would be appreciated to help me with that (:
Regards.

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

1 participant