Skip to content

Commit 0bb12a2

Browse files
committed
fix: should fix page not registered properly
1 parent d2c0f13 commit 0bb12a2

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/main.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,20 @@ export default class PanoPluginStaffPage extends PanoPlugin {
7373
});
7474

7575
if (config && config.displayLocation === 'THEME_PAGE' && config.pageUrl) {
76+
const pageUrl = config.pageUrl.startsWith('/') ? config.pageUrl : `/${config.pageUrl}`;
77+
7678
// Register dynamic route
7779
pano.ui.page.register({
78-
path: `${config.pageUrl}`,
80+
path: pageUrl,
7981
component: staffPageComponent,
8082
});
8183

8284
// Add to Theme Nav
8385
if (pano.ui.nav.site.editNavLinks) {
8486
pano.ui.nav.site.editNavLinks((navItems) => {
85-
if (!navItems.find((n) => n.href === `${config.pageUrl}`)) {
87+
if (!navItems.find((n) => n.href === pageUrl)) {
8688
navItems.push({
87-
href: `${config.pageUrl}`,
89+
href: pageUrl,
8890
text: `plugins.${pluginId}.pages.staff.title`
8991
});
9092
}

0 commit comments

Comments
 (0)