我使用的是Octopress 3,当我运行jekyll build时,它将生成正确的文件集(包括我的静态文件,请参见下面的文件列表):

      $ cd _site
:_site$ ls -a
.               CNAME               assets              google2d8.html  index-alternative.html
..              about               blog                increase-revenue.html       index.html

请注意,我整个jekyll生成的blog现在都安全地存储在\blog\中,这就是我想要的方式。

但是一旦我执行octopress deploy,它就会覆盖整个文件夹(它也会覆盖我现有的静态文件),请参见下面的 list :
      $ cd _site
:_site$ ls -a
.       ..      Gemfile     Gemfile.lock    about       css     feed.xml    index.html  jekyll

这是我的_config.yml:
title: My Title
email: some@email.com
description: > # this means to ignore newlines until "baseurl:"
     some description
baseurl: "/blog" # the subpath of your site, e.g. /blog
url: "http://example.com" # the base hostname & protocol for your site
twitter_username: myusername

source: '../'

# Build settings
markdown: kramdown
theme: minima

这是我的_deploy.yml
method: git                 # How do you want to deploy? git, rsync or s3.
site_dir: _site             # Location of your static site files.
git_url: my_git_url

git_branch: gh-pages-2       # Git branch where static site files are commited

注意:一旦我从_config.yml中删除以下行:source: '../',我的jekyll build就会像octopress deploy一样生成部署文件夹。

鉴于新的Octopress 3和在gh-pages分支上托管的现有静态站点,我如何将博客部署到该现有gh-pages站点的子目录中?

最佳答案

您没有正确设置根目录。
请遵循以下指示:
http://octopress.org/docs/deploying/subdir/

关于ruby - 如何将octopress 3部署到现有gh-pages站点内的子目录中?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39200501/

10-13 08:50