【发布时间】:2017-03-19 20:56:15
【问题描述】:
我正在尝试在 Gitlab 上部署一个 hugo 网站,但它返回以下错误:
WARN: 2016/11/04 14:57:24 hugo.go:547: Unable to find static directory for theme strange-case in /builds/joaoeira/hugo/themes/strange-case/static
主题“strange-case”位于主题文件夹内,并且它有一个静态文件夹,这就是为什么我发现这个问题令人费解。在这里,我包括了我部署网站所采取的步骤(它说 github,因为那是我的第一次尝试):
git submodule add https://github.com/ExchangeRate-API/strange-case.git
git remote add origin https://github.com/joaoeira/joaoeira.github.io.git
hugo -t strange-case
git add .
git commit -m "first commit"
git push origin master
hugo 给我的最后一条信息:
=============================================================
Your rendered home page is blank: /index.html is zero-length
* Did you specify a theme on the command-line or in your
"config.toml" file? (Current theme: "strange-case")
* For more debugging information, run "hugo -v"
=============================================================
有什么猜测吗?
我的 config.toml 文件:
baseurl = "https://joaoeira.gitlab.io"
title = "Lettuce be Cereal"
author = "João Eira"
copyright = "Your Copyright"
canonifyurls = true
paginate = 5
PygmentsCodeFences = false
googleAnalytics = ""
contentdir = "content/post"
layoutdir = "layouts"
publishdir = "public"
theme = "strange-case"
[params]
colorScheme = "scheme-darkbrown"
DateFormat = "2 Jan 2006"
description ="João Eira is a Master's student in Economics at Universidade de Coimbra."
sidebarDescription = "João Eira's personal blog"
sidebarFreeText = "\"Shared fictions are the necessary condition of social coordination.\""
piwikSiteID = ""
piwikURL = ""
[[menu.main]]
name = "About"
url = "http://joaoeira.com"
[[menu.main]]
name = "Twitter"
url = "http://twitter.com/joaoeira"
我的 .gitlab.ci.yml 文件。注意指定主题和所有内容的“hugo -t奇异案例-v”:
image: alpine:3.4
before_script:
- apk update && apk add openssl
- wget https://github.com/spf13/hugo/releases/download/v0.16/hugo_0.16_linux-64bit.tgz
- echo "37ee91ab3469afbf7602a091d466dfa5 hugo_0.16_linux-64bit.tgz" | md5sum -c
- tar xf hugo_0.16_linux-64bit.tgz && cp ./hugo /usr/bin
- hugo version
test:
script:
- hugo
except:
- master
pages:
script:
- hugo -t strange-case -v
artifacts:
paths:
- public
only:
- master
【问题讨论】:
-
子模块在我的情况下引起了问题。通过从主题的根文件夹中删除 .git 文件夹,将子模块转换为普通(非 git)文件夹。它能解决你的问题吗?
-
从那以后你设法解决了这个问题吗?