无法安装"lanyon"杰基尔主题 [英] Cannot install "lanyon" jekyll theme

查看:104
本文介绍了无法安装"lanyon"杰基尔主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开始此操作之前,请先做一些前言警告;

Before I begin this, some preface warning;

我对jekyll的了解为0. 我对红宝石的了解是0.

My knowledge of jekyll is 0. My knowledge of ruby is 0.

尽管我确实认为我做得很好,因为没有经验,只是今天就加入其中.也就是说,这对我来说是完全个新功能.

Though I do think I've done pretty well for having no experience and just stepping into it today. That said, this is all completely new to me.

我想尝试一下我的博客github pages,只是看我是否可以使它工作.我想将其称为全局变量.

I wanted to give it a try for my github pages for a blog, just to see if I could make it work. I am running into a huge issue with what I suppose would be called the global variables.

我在这里下载了Lanyon 兰昂

I downloaded Lanyon here; Lanyon

我从 Windows 8.1 x64 计算机按顺序执行了以下步骤.

I did the following steps, in order, from my Windows 8.1 x64 machine.

  1. 已安装 python 3.4.1 (链接)
  2. 使用 RailsInstaller 安装了 ruby​​ (
  1. Installed python 3.4.1 (link)
  2. Installed ruby using the RailsInstaller (link)
  3. Installed rubygems using gem update --system from a PowerShell console
  4. created a new github repository
  5. created a gh-pages branch in that repository
  6. created a Gemfile in that branch, with the following text

source 'https://rubygems.org'
gem 'github-pages'

然后与 Lanyon 一起工作.

  • 下载 Lanyon 并将其解压缩,然后将所有文件复制到新目录中
  • 将整个目录推送到分支gh-pages
  • 上的我的存储库中
  • 试图导航到给定的gh-pages网址.
  • downloaded Lanyon and extracted it, I copied all of the files into a new directory
  • pushed the entire directory to my repository on branch gh-pages
  • tried to navigate to the gh-pages given url.

现在我确实看到了索引页面,它确实具有内容,但是主题无效. css文件丢失.根据jekyll网站上有关主题结构的说明,我进行了一些更改. 链接

Now I did see the index page, it did have the content, but the theme wasn't working. The css files were missing. Per the instructions for theme structure found on jekyll's website, I made some changes; link

  • 按照api文档上建议的布局,我将head.htmlsidebar.html移到了_includes下一个名为themes/lanyon的新子文件夹中.
  • 我喜欢将css文件夹放到一个名为assets/themes/lanyon的新文件夹中,再次关注这些文档
  • 按照api文档中的示例,我将文件apple-touch-icon-144-precomposed.pngapple-touch-icon-precomposed.pngfavicon.ico移到了名为assets/themes/lanyon/img的新文件夹中.
  • I moved the head.html and sidebar.html into a new subfolder under _includes called themes/lanyon, per the suggested layout on the api docs.
  • I loved the css folder into a new folder called assets/themes/lanyon, again following those docs
  • I moved the files apple-touch-icon-144-precomposed.png, apple-touch-icon-precomposed.png, and favicon.ico into a new folder called assets/themes/lanyon/img, following the example in the api docs.

现在是最棘手的部分……试图使{{ ASSET_PATH }}正常工作.

Now comes the trickiest part ... trying to get the {{ ASSET_PATH }} to work.

  • 我查看了文件_includes/themes/lanyon/head.html,发现这3个CSS资源没有变量.
  • 我将它们更改为如下所示
  • I looked at the file _includes/themes/lanyon/head.html and saw the 3 css assets had no variables.
  • I changed them to look like the following
<link rel="stylesheet" href="{{ ASSET_PATH }}/css/poole.css">
<link rel="stylesheet" href="{{ ASSET_PATH }}/css/syntax.css">
<link rel="stylesheet" href="{{ ASSET_PATH }}/css/lanyon.css">

  • 我更新了_config.yml,使其看起来像这样,显然是填写了[]变量.
    • I updated _config.yml to look like this, obviously filling in the [] variables instead.
    • # For more see: http://jekyllrb.com/docs/permalinks/
      permalink: /:categories/:year/:month/:day/:title
      
      exclude: [".rvmrc", ".rbenv-version", "README.md", "Rakefile", "changelog.md"]
      pygments: true
      markdown: redcarpet
      
      title:            lanyon
      tagline:          'lanyon theme'
      author :
        name : Ciel
        email : stacey.cielia.lynn@gmail.com
        github : ciel
      
      paginate:         5
      
      production_url : http://[username].github.io
      
      Lanyon :
        version:      2.0.0
      
        BASE_PATH : "/[repositoryname]"
        ASSET_PATH : "/assets/themes/lanyon"
      

      但是即使如此,它仍然不起作用.如果我输入文件的绝对路径,它 does _ 可以正常工作,但是据我了解,这不是jekyll应该起作用的方式.

      But even with all of that, it still doesn't work. It does_ work if I type the absolute paths to the files, but that's not how jekyll is supposed to work, from my understanding.

      推荐答案

      要访问ASSET_PATH,请尝试:

      To access ASSET_PATH, try :

      {{ site.Lanyon.ASSET_PATH }}
      

      您正在使用Jekyll Bootstrap(JB)变量,而不是Jekyll变量.

      Edit : You're using Jekyll Bootstrap (JB) variables, not Jekyll ones.

      site.Lanyon.ASSET_PATH 特定于JB.这是'/assets/themes/lanyon '

      site.Lanyon.ASSET_PATH is specific to JB. Here it's '/assets/themes/lanyon'

      site.Lanyon.BASE_PATH (在Jekyll中为 site.baseurl )是从站点根目录到Jekyll安装目录的路径.

      site.Lanyon.BASE_PATH (site.baseurl in Jekyll) is the path from your site root to your Jekyll install.

      例如:如果您这样做 http://ciel.com/my/jekyll/site / 访问您的网站: site.Lanyon.BASE_PATH site.baseurl ='/my/jekyll/site '

      eg : If you do http://ciel.com/my/jekyll/site/ to reach you site : site.Lanyon.BASE_PATH or site.baseurl = '/my/jekyll/site'

      因此,如果您想从任何页面访问资产,则需要执行以下操作:

      So if you want to reach your assets from any page, you need to do :

      <link rel="stylesheet" href="{{ site.Lanyon.BASE_PATH }}{{ site.Lanyon.ASSET_PATH }}/css/poole.css">
      

      <link rel="stylesheet" href="{{ site.baseurl }}{{ site.Lanyon.ASSET_PATH }}/css/poole.css">
      

      等等!

      这篇关于无法安装"lanyon"杰基尔主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆