From 5af174bd2006d0d4464b5ab66fb5bce38b5ed3eb Mon Sep 17 00:00:00 2001 From: Bojan Djurkovic Date: Thu, 30 Mar 2017 20:26:53 -0300 Subject: [PATCH] in toURL test for anchor links and if so prepend the currentPath to the generated path. fixes #142 --- src/core/route/hash.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/route/hash.js b/src/core/route/hash.js index beba1f27..32c56609 100644 --- a/src/core/route/hash.js +++ b/src/core/route/hash.js @@ -66,11 +66,14 @@ export function parse (path = window.location.href) { * @param {object} qs query params */ export function toURL (path, params) { + const inline = path[0] === '#'; const route = parse(replaceSlug(path)) route.query = merge({}, route.query, params) path = route.path + stringifyQuery(route.query) path = path.replace(/\.md(\?)|\.md$/, '$1') + if (inline) path = currentPath + path; + return cleanPath('#/' + path) }