Skip to content

Commit

Permalink
fix: local route remove site root
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Oct 21, 2020
1 parent 949b132 commit f298df9
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions core/core/src/document-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down

0 comments on commit f298df9

Please sign in to comment.