I have my blogdown site that has been running for a while. When writing a post today I cannot get plots to render when running serve_site().
The plot generates fine when running the .Rmd in interactive mode, it's only when being built by knitting/serve_site/build_site that it doesn't work. The image below shows what I see on the webpage - just that small icon in the bottom.
I know these questions have come up a lot, so just to list the things I've tried:
There is no .gitignore under the static directory
I've set [markup.goldmark.renderer]unsafe = true in the config.toml
I've checked that the figures are being generated (I can see the files under index_files/figure-html)
You can see my blog source here
And the (not working) webpage here
Related
I have been working on blogdown to generate the following website. So far so good, however I have been trying to add codefolding which is easy to do in a common rmarkdown document.
I found this blogpost, where they do it. I have been trying to play with that, I did steps 1 and 2 for blogdown so generated the codefolding.js and modified the config.toml in the theme template as well, however when I get into the header and/or footer I got stuck, I even tried to generate a new post where I cloned and copied the whole folder here however it is not working an I get the following error
I am not sure what I did wrong here
I have an R flexdashboard that runs with shiny and although I have managed to host it on shinyapp.io, I cannot get images to render. I understand that normally, with a Shiny app, I would need to place the images in a 'www' folder. But with a flexdashboard there is no associated folder like that. How would I go about getting the images to load on shinyapp.io? Images show up completely fine when I run the flexdashboard locally.
It's ok to put your images in a www folder. Make sure to reference the path. Example markdown text:
Built with ![](www/shiny_50.png).
I was having problems rendering that image until I discovered that its original resolution was too large to fit in the chart window. I used the Magick package to resize.
I am writing a Rmd file, where it contains some knitted images. The Rmd file shows stuffs just as expected when looking at them on my own computer, but it cannot show the inserted images when uploaded to my github.
To knit the inserted images, I used here() function:
knitr::include_graphics(c(here("data/images/experiments_areaId2ad4/plots", "scatter_old.png"), here("data/images/experiments_areaId2ad4/plots", "scatter_new.png")))
On the github, the images cannot be shown, and as most html, there are tiny placeholders at the positions of each of the images. When I clicked on one of the place holder, it led me to a webpage that was 404.
I looked at the URL, it is like:
https://github.com/[my_github_account]/[my_github_repo]/blob/master/Users/[myname]/Desktop/[my_local_path]/[my_github_repo]/my_reports/data/images/experiments_areaId2ad4/plots/scatter_new.png
Obviously it has copied my local path from my computer to the github, so that the paths of these images are definitely not valid anymore.
However, I still want to use the here() function, so that when my collaborators pull my github updates, they can still interact with my projects without having to worry about screwing up directory.
Does anyone have a suggestion?
Thanks!
Rebuilding blogdown site is not rendering correctly for some themes.
Having created a new directory using the R Project Wizard in RStudio, I create a new site using a custom theme such as "AlexFinn/simple-a" or "zwbetz-gh/vanilla-bootstrap-hugo-theme" with blogdown::new_site(theme = "AlexFinn/simple-a"). Once created, I add the following to to config.TOML; ignoreFiles = ["\\.Rmd$", "\\.Rmarkdown$", "_files$", "_cache$"]
At this point, all is working as expected and I get a properly formatted example site.
When I press the 'Build Website' button in the Build panel in RStudio again OR I upload to Netlify, for these two themes, my website is rendered with all styling and images removed; black text - bolded and sized - and with a plain white background. With "gcushen/hugo-academic" the colours appear but the images are missing. Nothing appears different with the "road2stat/hugo-tanka".
I would understand this behaviour with the vanilla theme but "simple-a" and "hugo-academic" are mentioned in the blogdown book in chapter 1.6
I am using Hugo 0.53 and blogdown_0.10.1
Build Website is not for rendering the blogdown website, What it does is to render multiple Rmarkdown documents into a website.
You should use Addins -> Serve Site or call the command blogdown::serve_site() instead.
For more information on the difference between rmarkdown::render_site() and blogdown, you can read
help("render_site", package="rmarkdown") and
The rmarkdown official manual
I am considering switching my website to blogdown. My current set-up only uses .Rmd files with a less-than-ideal blog implementation. It seems like one advantage of blogdown is that it automates the blogging part of the website (posts, lists, dates, etc.) and allows RMarkdown. This is my main motivation to switch. However, the downside, I think, is that I cannot create content pages in RMarkdown (i.e., content > about.Rmd)... it seems this is limited to .md files. I would like to use .Rmd for all the pages so that I can incorporate r code. My question: Is it possible to create .Rmd content pages in blogdown?
EDIT...
Specifically, I created by hand research.Rmd in the content folder. I can include a trivial example, such as...
`r 2 + 2`
and when I run serve_site() the r code is not rendered. I can knit the file by hand, but the file does not have the style of the theme I am using and once I again try to serve the site the file is rendered as if it were a .md file.
```
EDIT 2...
You can reproduce the behavior I am referring to by doing the following...
Create a new blowdown site: new_site(dir = ".", theme = 'gcushen/hugo-academic')
Create new content: new_content('test/index.Rmd')
Set draft to false and add trivial r code: I used 2 + 2 as shown above.
Serve site and go to test/index.html. There is no r code rendered.
From your Edit 2, you seem to have fallen into a common Hugo trap: content/test/index.Rmd does not necessarily generate test/index.html. Hugo uses the convention _index.md to generate a homepage for a subfolder, and you have to use content/test/_index.Rmd in your case. For content/about.Rmd or content/research.Rmd, they will generate about/index.html and research/index.html respectively by default.