Hugo在使用blogdown后没有阅读.rmd文件

我正在使用
Github Pages和Hugo(proquestionasker.github.io)创建一个网站.目前,当我在RMarkdown中创建项目文件或博客文章时,我必须在Hugo / Github读取它们之前将它们转换为markdown(.md)文件.
blogdown套装似乎非常适合我的需求,但我无法让它发挥作用.

我已经下载了Hugo和blogdown.我的步骤目前如下(在项目目录中作为我的工作目录):

(在R工作室)

    # 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内容添加到文件中.我保存文件.此时,我只想测试Hugo是否可以在将更改推送到Github之前解释此文件,所以在R中:

    # Build Site
    blogdown::build_site()

我收到了Hugo期望的正常“网站建设”反馈.当我查看public / portfolio文件夹时,我看到一个“new.Rmd”.到现在为止还挺好.

问题出在实际查看网站上.我尝试以“正常”的Hugo方式预览网站:

    # In terminal window
    hugo server

然后在我的浏览器窗口中启动http://localhost:1313/.我的投资组合部分显示在主页上,并显示所有.md格式的文件,但不显示new.Rmd.

我认为这可能是一个问题因为hugo服务器似乎仍在使用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 \
        git@github.com: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 
        git@github.com:ProQuestionAsker/ProQuestionAsker.github.io.git master

这些文件都出现在我的GitHub库中,正如我所期望的那样,但Hugo似乎没有呈现除.md文档以外的任何内容.这些都在网站上显示预期.我不确定这是Hugo问题还是Blogdown问题,但我似乎无法让它发挥作用.

任何帮助将非常感激!

最佳答案 这个问题实际上不是blogdown的问题,但经过几个小时的搜索和探索,我发现它似乎是我正在使用的主题的问题.按照上面列出的步骤,让blogdown,hugo和github页面一起工作就好了.

点赞