Skip to content

integration with strapi? #159

@hrahimi270

Description

@hrahimi270

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions