我正在尝试在Github Pages上部署一个内置blogdown的网站,并遇到一些问题,其中一些内容导致实时版本中的404,但在RStudio中提供时工作正常。
可以查看已部署的页面here,并可在Github上查看其来源。
相关网页位于https://dshkol.github.io/2017/08/30/starting-a-blog/ - 正在打开,产生404错误。在RStudio中使用blogdown::serve_site
启动时,此页面呈现正常。
重要的是,blogdown页面的所有其他部分都适用于RStudio和Github Pages。这包括/ Projects /,/ Contact /和/ About /。
该网站使用Hugo Ghostwriter主题,这是blogdown文档中推荐的主题之一。
TOML文件的相关(?)部分:
baseurl = "https://dshkol.github.io/"
publishDir = "../dshkol.github.io"
title = "dshkol blog"
theme = "ghostwriter"
languageCode = "en-us"
disqusShortname = "dshkol"
googleAnalytics = "XXX"
ignoreFiles = ["\\.Rmd$", "\\.Rmarkdown$", "_files$", "_cache$"]
[Taxonomies]
tag = "tags"
[Params]
intro = true
headline = "DSHKOL"
description = "Thoughts and words"
opengraph = true
shareTwitter = true
shareFacebook = true
shareGooglePlus = true
shareLinkedIn = false
dateFormat = "Mon, Jan 2, 2006"
highlightJsUrl = ""
highlightJsLocalUrl = ""
[Permalinks]
post = "/:year/:month/:day/:slug/"
[[menu.main]]
name = "Blog"
url = "/"
weight = 1
[[menu.main]]
name = "Projects"
url = "/project/"
weight = 2
[[menu.main]]
name = "Contact"
url = "/page/contact/"
weight = 3
[[menu.main]]
name = "About"
url = "/page/about/"
weight = 4
我的会话信息:
R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_0.12.12 bookdown_0.5 digest_0.6.12 rprojroot_1.2 mime_0.5 backports_1.1.0
[7] magrittr_1.5 evaluate_0.10.1 blogdown_0.1.3 stringi_1.1.5 rmarkdown_1.6 tools_3.4.1
[13] servr_0.7 stringr_1.2.0 httpuv_1.3.5 compiler_3.4.1 htmltools_0.3.6 knitr_1.17
相关的雨果细节:
> Sys.which('hugo')
hugo
""
> blogdown:::find_hugo()
[1] "/Users/dshkol/Library/Application Support/Hugo/hugo"
> blogdown::hugo_version()
[1] ‘0.26’
答案 0 :(得分:1)
从提交7da94409016057580648c15c7f7cb9886ad4d6a1开始,您还没有将帖子2017/08/30/starting-a-blog/index.html
推送到您的Github回购。如果通过Github Pages部署,则应提交并推送public/
文件夹中的所有内容。
正如我在the blogdown book写的那样,建议您通过Netlify而不是Github Pages进行部署,除非您可以证明后者的合理性(我个人认为没有一个理由说明为什么还应该使用Github Pages进行构建网站;这里是another shout-out)。