Drafts rendered by netlify when draft: true in yaml

让人想犯罪 __ 提交于 2019-12-11 01:47:00

问题


I am running at blogdown site from this github repo hosted by Netlify at https://timmastny.rbind.io/

In website2/content/blog/ I have two posts

2018-01-16-git-blogdown-project-workflow.Rmd

and 2018-01-13-bayesian-meta-analysis-powerlifting.Rmd

You can see that in the YAML of both posts, I have draft: true and in the second one I even have publishdate: '2018-01-20' which is in the future as of this post.

However, with these changes pushed to github and Netlify deployed with a clean cache, on my actual website I still see the posts: https://timmastny.rbind.io/

What am I missing about draft: true?

I've read sections 2.3.1 and D.3 of the books, but I'm not sure. I've also updated Hugo to 0.32.4 and am on the latest version of blogdown.


Edit: I've deleted the public folder and added public to gitignore. Netlify had a 16 minute build which was published. But on the actual website I get a Page Not Found error.

Here's the log: https://app.netlify.com/sites/timmastny/deploys/5a60c299df99532a0147c3d7

Here's my deploy settings on Netlify. They should match the suggestions in 3.1 of the blogdown book:

Deploy settings

Repository: https://github.com/tmastny/website2

Build command: hugo

Publish directory: public

Production branch: master

Branch deploys: Deploy only the production branch and its deploy previews

Public deploy logs: Logs are public

Build environment variables: HUGO_VERSION 0.32.4


回答1:


I am going to assume you are using public as your deploy folder for Netlify.

Issue #1

Your public folder is in your repository, so it is checked out to the Netlify site and when you run your build your posts already exist in that folder, so they are always going to be deployed.

Solution #1

Delete the public folder from your project and add a .gitignore for the public folder.

The deploy should build the public folder fresh on each deploy, so it can compare the CDN with your build and copy the correct files only.

Issue #2 (updated question)

The Hugo theme is set to theme = "hugo-xmin" in the config.toml. When checking out the repository from GitHub, this theme folder is empty. It would be empty on Netlify as well, so the build becomes invalid.

Solution #2

Changed to a valid theme theme = "hugo-lithium-theme" in the config.toml and the build starts to create your site pages.

Original Issue

When updating draft: true in .Rmd does not ignore on build.

Solution (for Original)

Hugo is not processing your content for .Rmd, it is using your content from the processed .html files created. So you need to make sure you are committing the content for those files with draft: true in them to your repository before a build.



来源:https://stackoverflow.com/questions/48312933/drafts-rendered-by-netlify-when-draft-true-in-yaml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!