简体   繁体   中英

Using default Hugo theme content through Netlify produces blank webpage, but works locally. blogdown

I have found the same/similar question to mine here: Create a new static page using blogdown with same hugo theme as main site but I cannot understand what the solution is as there seems not to be one explicitly, or I just do not grasp it.

I am an absolute beginner. I am testing the procedure to move generated code to netlify to produce a website.

I can put the public/post/2020-12-01-r-rmarkdown/index.html file into public/ folder in github and generate the example site on netlify eg:

https://github.com/hjhjonas/blogsite/tree/main/public produces

https://elastic-ptolemy-e2ba86.netlify.app/

However I plan to edit the default theme and use that instead. But the default index.Rmd file that produces the index.html file after i edit the yaml files and content files to use is like this:

https://github.com/hjhjonas/blogsite/blob/main/index.html

and produces a blank page on netfify.

在此处输入图片说明

But if I knit from Rstudio and serve_site() locally, it looks like this image attached, which is correctly what I need.

在此处输入图片说明

What I want to do is edit this original theme/layout and put the generated html into the public folder in github for Netlify to read.

The index.Rmd file that produces this local site is just

---
site: blogdown:::blogdown_site
---

I previous had a 404 error on netlify and followed these steps to realise that the html is required for Netlify to produce the deploy the page: https://answers.netlify.com/t/support-guide-i-ve-deployed-my-site-but-i-still-see-page-not-found/125

This is the theme that I would like to use https://themes.gohugo.io/themes/hugo-lodi-theme/

I don't know how you generated the public/ folder, but it is not meant to be generated by manually copying or moving any files to it. If you publish a site via Netlify, there is no need to generate the public/ folder locally at all, because it can be automatically generated on Netlify.

First, delete index.html in the root directory, and please do not knit index.Rmd again in the future. Second, delete the public/ folder. After the two deletions, I think your site should appear on Netlify soon. If not, see if blogdown::check_site() has any recommendations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM