From f298df9c1ccb80d2080524638699aa836da46899 Mon Sep 17 00:00:00 2001 From: atanasster Date: Wed, 21 Oct 2020 04:02:48 -0400 Subject: [PATCH] fix: local route remove site root --- core/core/src/document-utils.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/core/core/src/document-utils.ts b/core/core/src/document-utils.ts index b86d917ff..2c67177b7 100644 --- a/core/core/src/document-utils.ts +++ b/core/core/src/document-utils.ts @@ -104,13 +104,17 @@ export const getHomePath = (store: Store) => { export const getRoutePath = (store: Store, route?: string) => { const { siteRoot = '/' } = (store?.config as BuildConfiguration) || {}; - - return route - ? removeTrailingSlash( - `${ensureTrailingSlash(siteRoot)}${removeStartingSlash(route)}`, - ) - : undefined; + if (route) { + if (route.startsWith('#')) { + return route; + } + return removeTrailingSlash( + `${ensureTrailingSlash(siteRoot)}${removeStartingSlash(route)}`, + ); + } + return undefined; }; + export const docStoryToId = (docId: string, storyId: string) => toId(docId, storyNameFromExport(storyId));