summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-core
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gitbook-core')
-rw-r--r--packages/gitbook-core/src/components/Link.js13
-rw-r--r--packages/gitbook-core/src/models/SummaryArticle.js1
-rw-r--r--packages/gitbook-core/src/shapes/SummaryArticle.js1
3 files changed, 7 insertions, 8 deletions
diff --git a/packages/gitbook-core/src/components/Link.js b/packages/gitbook-core/src/components/Link.js
index f5b9753..145486e 100644
--- a/packages/gitbook-core/src/components/Link.js
+++ b/packages/gitbook-core/src/components/Link.js
@@ -19,19 +19,16 @@ const Link = React.createClass({
])
},
- getHref() {
- let { currentFile, to } = this.props;
+ render() {
+ const { currentFile, to, children, ...props } = this.props;
+ let href = to;
if (SummaryArticle.is(to) || File.is(to)) {
- to = to.url;
+ href = to.url;
}
- return currentFile.relative(to);
- },
+ href = currentFile.relative(href);
- render() {
- const { children, ...props } = this.props;
- const href = this.getHref();
return <a href={href} {...props}>{children}</a>;
}
});
diff --git a/packages/gitbook-core/src/models/SummaryArticle.js b/packages/gitbook-core/src/models/SummaryArticle.js
index 0f8ca0d..3651c8a 100644
--- a/packages/gitbook-core/src/models/SummaryArticle.js
+++ b/packages/gitbook-core/src/models/SummaryArticle.js
@@ -4,6 +4,7 @@ const DEFAULTS = {
title: '',
depth: 0,
path: '',
+ url: '',
ref: '',
level: '',
articles: List()
diff --git a/packages/gitbook-core/src/shapes/SummaryArticle.js b/packages/gitbook-core/src/shapes/SummaryArticle.js
index c5aa717..c93bdd9 100644
--- a/packages/gitbook-core/src/shapes/SummaryArticle.js
+++ b/packages/gitbook-core/src/shapes/SummaryArticle.js
@@ -13,6 +13,7 @@ const Article = shape({
title: string.isRequired,
depth: number.isRequired,
path: string,
+ url: string,
ref: string,
level: string,
articles: list