我正在使用Github Pages和Hugo(proquestionasker.github.io)创建一个网站。目前,当我在RMarkdown中创建项目文件或博客文章时,我必须在Hugo/Github阅读它们之前将它们转换为markdown(.md)文件。 blogdown包似乎是完全适合我的需求,但我无法实现它的工作。Hugo没有阅读.Rmd文件使用博客后
我已经下载了雨果和博客。我的脚步,目前如下(在项目目录作为我的工作目录中):
(在读工作室)
# Create new file in the "content/portfolio" folder
blogdown::new_content("portfolio/new.Rmd", format = "yaml")
这产生了我所期望的文件夹中的一个新的.Rmd文件。标题如下:
---
date: 2016-12-15T16:02:46-08:00
draft: true
image: "img/portfolio/map.png"
showonlyimage: false
title: test
---
我继续将R内容添加到文件中,就像我在任何R文档中一样。我保存该文件。在这一点上,我只是想测试一下,如果之前我推变化Github的雨果可以解释这个文件,所以在R:
# Build Site
blogdown::build_site()
我收到正常的“网站建设”的反馈,我从雨果期待。当我查看公共/组合文件夹时,我看到一个“new.Rmd”。到现在为止还挺好。
问题出在实际查看网站。我尝试预览该网站的“正常”雨果方式:
# In terminal window
hugo server
然后在我的浏览器窗口中启动http://localhost:1313/。我的投资组合件显示在主页上,并且显示所有.md格式的文件,但new.Rmd不是。
我认为这可能是一个问题,因为hugo server
似乎仍然使用hugo而不是博客来构建网站。所以我绕过预览网站,直接将修改提交给GitHub。
我的网站的设置方式是将主分支(包含“公共”文件夹中的所有网站构建项目)作为“源”分支的子树。我遵循正常的更新流程(如下所示,受this post的启发),但不是使用hugo构建网站,而是使用blogdown构建网站。过程如下:
# In terminal window - Adding new documents
git add -A
git commit -am "Adding new blogdown documents"
git push
# Pulling down the master branch into 'public' to help avoid merge conflicts
git subtree pull --prefix=public \
[email protected]:ProQuestionAsker/ProQuestionAsker.github.io.git master -m "Merge origin master"
# In RStudio - Build website using blogdown
build_site()
# In terminal window - Pushing the updated 'public' folder to the 'sources' branch
git add public
git commit -m "Pushing updated public folder to source branch"
git push origin "sources"
# Pushing the updated 'public' folder to the 'master' branch
git subtree push --prefix public
[email protected]:ProQuestionAsker/ProQuestionAsker.github.io.git master
都出现在我的GitHub库中的文件,我希望他们来,但胡戈似乎并没有被渲染比.MD文件的任何其他。这些全部在网站上按预期显示。我不确定这是Hugo问题还是Blogdown问题,但我似乎无法使其工作。
任何帮助将不胜感激!
使用'blogdown :: serve_site()'而不是'hugo server'。后者不了解Rmd。 –
感谢帮助!按照上面列出的步骤实际上确实起作用了,这与blogdown无关,导致我的问题。 –