Jekyll site.baseurl在永久链接中输了

时间:2015-02-03 10:45:23

标签: html css jekyll permalinks

我正在和杰基尔合作建立一个小网站。由于我们想隐藏帖子的日期,我们永久链接。

在localhost上,index.html已经很好地展示了,包含了正确的css。

浏览器从以下位置获取css:

127.0.0.1:4000/css/styles.css

当我到达帖子时,我的CSS消失了,因为浏览器在这里寻找css:

127.0.0.1:4000/permalink/css/styles.css

这是我的config.yaml看起来像(我使用//当我需要隐藏信息时):

# Site settings
title: //
email: //•//.fr
description: > # this means to ignore newlines until "baseurl:"
  //.
baseurl: "" # the subpath of your site, e.g. /blog/
url: "http://127.0.0.1:4000" # the base hostname & protocol for your site
twitter_username: jekyllrb
github_username: jekyll

# Build settings
markdown: kramdown

relative_permalinks: true


sass:
    style: :compressed
    sass_dir: _sass

和include / head.html:

<!--[if lte IE 8]><script src="css/ie/html5shiv.js"></script><![endif]-->
    <script src="{{ "/js/jquery.min.js" | prepend: site.baseurl }}"></script>
    <script src="{{ "/js/jquery.scrollzer.min.js" | prepend: site.baseurl }}"></script>
    <script src="{{ "/js/jquery.scrolly.min.js" | prepend: site.baseurl }}"></script>
    <script src="{{ "/js/skel.min.js" | prepend: site.baseurl }}"></script>
    <script src="{{ "/js/skel-layers.min.js" | prepend: site.baseurl }}"></script>
    <script src="{{ "/js/init.js" | prepend: site.baseurl }}"></script>
    <noscript>
      <link rel="stylesheet" href="{{ site.baseurl }}css/skel.css"/>
      <link rel="stylesheet" href="{{ site.baseurl }}css/style.css"/>
      <link rel="stylesheet" href="{{ site.baseurl }}css/style-xlarge.css"/>
    </noscript>
    <!--[if lte IE 8]><link rel="stylesheet" href="css/ie/v8.css" /><![endif]-->

找到javascript文件没有问题,这就是为什么我认为href / src文件调用中有一些东西。

如果有人有想法,我会很高兴。

非常感谢。 菊

2 个答案:

答案 0 :(得分:3)

此外,您可以从

更改指向css的链接
<link rel="stylesheet" href="{{ site.baseurl }}css/skel.css"/>

<link rel="stylesheet" href="{{ site.baseurl }}/css/skel.css"/>

答案 1 :(得分:0)

找到了,

看起来像我在javascript中使用的html5up.com模板。

刚刚在模板init.js中更改了这个:

skel.init({
        reset: 'full',
        breakpoints: {
            global: { href: '{{ site.baseurl }}/css/style.css', containers: '45em', grid: { gutters: ['2em', 0] } },
            xlarge: { media: '(max-width: 1680px)', href: '{{ site.baseurl }}/css/style-xlarge.css' },
            large: { media: '(max-width: 1280px)', href: '{{ site.baseurl }}/css/style-large.css', containers: '42em', grid: { gutters: ['1.5em', 0] }, viewport: { scalable: false } },
            medium: { media: '(max-width: 1024px)', href: '{{ site.baseurl }}/css/style-medium.css', containers: '85%!' },
            small: { media: '(max-width: 736px)', href: '{{ site.baseurl }}/css/style-small.css', containers: '90%!', grid: { gutters: ['1.25em', 0] } },
            xsmall: { media: '(max-width: 480px)', href: '{{ site.baseurl }}/css/style-xsmall.css' }
        },

并添加YAML start以获取jekyll处理的文件。