Hugo / Blogdown 图像在 GitHub/Netlify 部署后无法呈现

时间:2021-06-05 21:01:32

标签: netlify hugo blogdown

这是我第一次提问,如果我做了一些愚蠢的事情,请提前道歉。

我用 blogdown 写了我的第三篇博文。我在前两个上使用了图像,一切顺利,但这是第一个用 R 代码创建图像的:

png_1 <- image_read_pdf("index_files/pdf_with_image_1.pdf")

print(png_1)

这创建了一个新文件夹,路径如下所示:

<块引用>

\content\pos​​t\2021-06-05-mining-text-from-pdf-files-part-3-pdf-with-an-image\index_files\figure-html\

图像本身以这种方式命名:unnamed-chunk-4-1.png

写完帖子后,我做了通常的 Git/GitHub 仪式,Netlify 似乎正常部署了帖子。

然而,这是网站上的样子(图片未显示):

enter image description here

我试图在 GitHub、RStudio 社区甚至这里阅读类似的问题,但我没有找到问题的直接答案。

html 代码如下所示:

img src="{{< blogdown/postref >}}index_files/figure-html/unnamed-chunk-4-1.png" width="1650"

我还使用了 blogdown::check_site() 来查看那里是否有任何内容。至少没有 [TODO]:

― Checking config.yaml
| Checking "baseURL" setting for Hugo...
○ Found baseURL = "https://youcanbeapirate.netlify.com/"; nothing to do here!
| Checking "ignoreFiles" setting for Hugo...
○ "ignoreFiles" looks good - nothing to do here!
| Checking setting for Hugo's Markdown renderer...
○ All set! Found the "unsafe" setting for goldmark.
― Check complete: config.yaml

― Checking .gitignore
| Checking for items to remove...
○ Nothing to see here - found no items to remove.
| Checking for items to change...
○ Nothing to see here - found no items to change.
| Checking for items you can safely ignore...
○ Found! You have safely ignored: Thumbs.db, .DS_Store
| Checking for items to ignore if you build the site on Netlify...
○ Found! You have safely ignored: /resources/, /public/
| Checking for files required by blogdown but not committed...
○ Great! Did not find such files.
― Check complete: .gitignore

― Checking Hugo
| Checking Hugo version...
○ Found Hugo. You are using Hugo 0.83.1.
| Checking .Rprofile for Hugo version used by blogdown...
○ blogdown is using Hugo 0.83.1 to build site locally.
― Check complete: Hugo

― Checking netlify.toml...
○ Found HUGO_VERSION = 0.83.1 in [build] context of netlify.toml.
| Checking that Netlify & local Hugo versions match...
○ It's a match! Blogdown and Netlify are using the same Hugo version (0.83.1).
| Checking that Netlify & local Hugo publish directories match...
○ Good to go - blogdown and Netlify are using the same publish directory: public
― Check complete: netlify.toml

― Checking content files
| Checking for validity of YAML metadata in posts...
○ All YAML metadata appears to be syntactically valid.
| Checking for previewed content that will not be published...
○ Found 0 files with future publish dates.
○ Found 0 files marked as drafts.
| Checking your R Markdown content...
○ All R Markdown files have been knitted.
○ All R Markdown output files are up to date with their source files.
| Checking for .html/.md files to clean up...
○ Found 0 duplicate .html output files.
○ Found 0 incompatible .html files to clean up.
| Checking for the unnecessary 'content/' directory in theme...
○ Great! Your theme does not contain the content/ directory.
― Check complete: Content

链接到 GitHub repo

如果需要,我可以提供更多信息。

PS:我也在 RStudio Community 上提出了同样的问题

1 个答案:

答案 0 :(得分:0)

在您在该存储库中的最新帖子中,我发现有一个奇怪的文件 (https://github.com/AnttiRask/blog/blob/master/content/post/2021-06-05-mining-text-from-pdf-files-part-3-pdf-with-an-image/index.Rmd.lock~),我想这可能是导致问题的原因。我很快从我的角度进行了测试,如果我删除该文件并重新编织该 RMD 文件,它会起作用。