mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-24 03:16:40 +00:00
Fix all relative links
This commit is contained in:
@@ -17,7 +17,7 @@ var generate = function(root, output, options) {
|
||||
github: null
|
||||
});
|
||||
|
||||
if (!options.github) return Q.reject(new Error("Need options.github for specifing the github origin"));
|
||||
if (!options.github || !options.title) return Q.reject(new Error("Need options.github and optiosn.title"));
|
||||
|
||||
// List all files in the repository
|
||||
return Q.nfcall(glob, "**/*", {
|
||||
|
||||
@@ -22,9 +22,12 @@ var initTemplate = function(options) {
|
||||
});
|
||||
|
||||
return function(input, output, local) {
|
||||
var _input = input;
|
||||
input = path.join(options.root, input);
|
||||
output = path.join(options.output, output);
|
||||
|
||||
var basePath = path.relative(path.dirname(output), options.output) || ".";
|
||||
|
||||
// Read markdown file
|
||||
return fs.readFile(input, "utf-8")
|
||||
|
||||
@@ -37,8 +40,10 @@ var initTemplate = function(options) {
|
||||
.then(function(sections) {
|
||||
return tpl(
|
||||
_.extend(local || {}, options.locals, {
|
||||
_input: input,
|
||||
content: sections
|
||||
_input: _input,
|
||||
content: sections,
|
||||
basePath: basePath,
|
||||
staticBase: path.join(basePath, "gitbook")
|
||||
})
|
||||
);
|
||||
})
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<div class="book-summary">
|
||||
<ul class="summary">
|
||||
<li>
|
||||
<a href="/book/{{ book.attributes.full_name }}/README.md">Introduction</a>
|
||||
<a href="{{ basePath }}/README.html">Introduction</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://github.com/{{ book.attributes.owner.login }}" target="blank">About the author</a>
|
||||
<a href="https://github.com/{{ owner }}" target="blank">About the author</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
{% for item in summary.chapters %}
|
||||
<li>
|
||||
<a href="{{ item.chapter.path }}">{{ item.chapter.title }}</a>
|
||||
<a href="{{ basePath }}/{{ item.chapter.path }}">{{ item.chapter.title }}</a>
|
||||
{% if item.articles.length > 0 %}
|
||||
<ul class="articles">
|
||||
{% for article in item.articles %}
|
||||
<li>
|
||||
<a href="{{ article.path }}">{{ article.title }}</a>
|
||||
<a href="{{ basePath }}/{{ article.path }}">{{ article.title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
{% else %}
|
||||
<meta name="robots" content="{% block robots %}noindex, nofollow{% endblock %}">
|
||||
{% endif %}
|
||||
<link rel="icon" href="gitbook/images/icons/32.png">
|
||||
<link rel="stylesheet" href="gitbook/style.css">
|
||||
<link rel="icon" href="{{ staticBase }}/images/icons/32.png">
|
||||
<link rel="stylesheet" href="{{ staticBase }}/style.css">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta name="description" content="{% block description %}{% endblock %}">
|
||||
<meta name="keywords" content="{% block keywords %}{% endblock %}" >
|
||||
@@ -19,7 +19,7 @@
|
||||
<meta name="og:site_name" content="GitBook">
|
||||
<meta name="og:url" content="{{ config.web.url }}">
|
||||
<meta name="og:description" content="{% block description %}{% endblock %}">
|
||||
<meta name="og:image" content="gitbook/images/icons/ios.png" >
|
||||
<meta name="og:image" content="{{ staticBase }}/images/icons/ios.png" >
|
||||
<meta name="application-name" content="Gitbook">
|
||||
<meta name="application-url" content="{{ config.web.url }}">
|
||||
<meta name="msapplication-tooltip" content="{% block description %}{% endblock %}">
|
||||
|
||||
Reference in New Issue
Block a user