Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/ContentNode/Reference.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default {
} = this.$router.resolve(url) || {};

// Resolved internal URLs don't have the "not found" route.
return name !== notFoundRouteName;
return !name.startsWith(notFoundRouteName);
},
isSymbolReference() {
return this.kind === 'symbol' && !this.hasInlineFormatting
Expand Down
30 changes: 19 additions & 11 deletions src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,20 @@ import {
import ServerError from 'theme/views/ServerError.vue';
import NotFound from 'theme/views/NotFound.vue';

export default [
export const fallbackRoutes = [
{
path: '*',
name: notFoundRouteName,
component: NotFound,
},
{
path: '*', // purposefully unreachable without a forced navigation
name: serverErrorRouteName,
component: ServerError,
},
];

export const pagesRoutes = [
{
path: '/tutorials/:id',
name: 'tutorials-overview',
Expand All @@ -38,14 +51,9 @@ export default [
/* webpackChunkName: "documentation-topic" */ 'theme/views/DocumentationTopic.vue'
),
},
{
path: '*',
name: notFoundRouteName,
component: NotFound,
},
{
path: '*', // purposefully unreachable without a forced navigation
name: serverErrorRouteName,
component: ServerError,
},
];

export default [
...pagesRoutes,
...fallbackRoutes,
];
14 changes: 4 additions & 10 deletions src/setup-utils/SwiftDocCRenderRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,19 @@
*/

import Router from 'vue-router';
import {
notFoundRouteName,
serverErrorRouteName,
} from 'docc-render/constants/router';
import {
saveScrollOnReload,
restoreScrollOnReload,
scrollBehavior,
} from 'docc-render/utils/router-utils';
import routes from 'docc-render/routes';
import routes, { pagesRoutes, fallbackRoutes } from 'docc-render/routes';
import { baseUrl } from 'docc-render/utils/theme-settings';
import { addPrefixedRoutes } from 'docc-render/utils/route-utils';

const defaultRoutes = [
...routes,
...addPrefixedRoutes(routes, [
notFoundRouteName,
serverErrorRouteName,
]),
...pagesRoutes,
...addPrefixedRoutes(routes),
...fallbackRoutes,
];

export default function createRouterInstance(routerConfig = {}) {
Expand Down