How to rebase Plasmic routes?

Other question (sorry for the spam, we are still learning Plasmic!): my project has all the plasmic pages under /cms/ path. The pages in plasmic are not aware of that, so if I add a link via the UI (e.g. say /blog/entry1), the link works ok in studio.plasmic.app, but in the app is broken, because it tries to direct the user to that URL instead of /cms/blog/entry1. Clearly I can fix the URL in the project, but that means the studio app won’t know how to work with it. Is there a solution that works both inside and outside the studio?

Hi! In the UI, when you add links to other plasmic pages in Studio, are you entering the URL manually or selecting from the dropdown? Also, which platform are you using (e.g. Next.js)

I’d suggest using the dropdown menu. For example if using Next.js, the PlasmicLoader plugin will automatically populate the correct path so you don’t need to be hacking the path.

Hi @notable_penguin , regardless of whether you’re using a dropdown or typing it in, it sounds like the issue is that the in-Plasmic pages and links aren’t prefixed with /cms/ but are in your app? Is there any reason you need that? We generally expect the routes to line up exactly.

@yang I am not using Plasmic for all the pages in my website, hence why they sit under the /cms/ route, instead of /. @ray I need to add the URL manually, otherwise the ones provided by the Plasmic app do not work (they assume Plasmic pages are sitting in /). I am using Next.js. . @ray are you saying I can add some configuration in the PlasmicLoader to inform Plasmic that […catchall].tsx is placed under /cms/ ? This is what I have

import { initPlasmicLoader } from "@plasmicapp/loader-nextjs";
export const PLASMIC = initPlasmicLoader({
  projects: [
    {
      id: "some-project-id",
      token: process.env.PLASMIC_BLOG_TOKEN
    },
    {
      id: "other-project-id",
      token: process.env.PLASMIC_MAIN_TOKEN
    }
  ],
  // Fetches the latest revisions, whether or not they were unpublished!
  // Disable for production to ensure you render only published changes.
  preview: process.env.NEXT_PUBLIC_ENV !== "production",
})

Are you setting the path in the page settings? I suggest you do that with the correct absolute path. Then use the dropdown to pick the pages you want.

Screenshot from 2022-03-08 10-05-23.png

@ray thanks for the note! I did not realise I could have placed the plasmic page in /pages/ without compromising all other (non-Plasmic) pages. That was why I placed it inside /pages/cms/ instead. All works as expected, thanks!