This answer remains valid. But I have to admit that it is not very portable to configure baseurl. You cannot always guess the right path.
Try making it run on a file system with related URLs, for example ./path/to.
What do we need to configure
, file:///path/to/_site/index.html, :
- .
file:///jekyll/update/2016/08/05/welcome-to-jekyll.html /:categories/:year/:month/:day/:title.html permalink. , hierachy - .- . , ,
/about/, , file:///about/
, .
_config.yml :
defaults:
-
scope:
type: "posts"
values:
permalink: :slug:output_ext
-
scope:
type: "pages"
values:
permalink: :basename:output_ext
.
about. ?
permalink . permalink: /about/ front.md, /path/to/_site/about.html. !
, ./.
_includes/head.html
<link rel="stylesheet" href="{{ "/css/main.css" | prepend: site.baseurl }}">
<link rel="stylesheet" href="{{ "./main.css" }}">
_includes/header.html
<a class="site-title" href="{{ site.baseurl }}/">{{ site.title }}</a>
<a class="site-title" href="./index.html">{{ site.title }}</a>
<a class="page-link" href="{{ my_page.url | prepend: site.baseurl }}">{{ my_page.title }}</a>
<a class="page-link" href="./{{ my_page.url }}">{{ my_page.title }}</a>
index.html
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
<a class="post-link" href="./{{ post.url }}">{{ post.title }}</a>
.
, .