cstories-app / cstories-app.github.io

Community driven story building app to inform offshore energy planning
https://cstories.integral-corp.com/
MIT License
2 stars 0 forks source link

trouble rendering RSS news QMDs #13

Closed bbest closed 1 year ago

bbest commented 1 year ago

From @jzadra (creating issue here to document solution for when we solve and reference if happens again later) ...

Hi Ben,

Can you try rendering https://github.com/cstories-app/cstories-app.github.io/blob/main/news/WST1_NC3-.qmd ? I have suddenly been unable to render any of my new RSS news QMDs and now also my older newsapi.org news QMDs. Caleb has replicated this using the quarto cli.

In addition, RStudio seems to be having an issue where it is reporting the same error for code from the first qmd I render on a second qmd that doesn't have the code referenced in the error (https://github.com/cstories-app/cstories-app.github.io/blob/main/news/Gntc_Ph.O_2022-12-06.qmd)

Result of trying to render the WST1_... file: image

Then trying to render the Gntc_Ph.... file. Note that the "image: " line in this file is not what the error is showing, and the background job Preview: bar shows the WST1 file: image

bbest commented 1 year ago

Having trouble reading the error from image above, but able to reproduce the problem when rendering:

Weirdly, am getting the same error rendering WST1_NC3-.qmd even after removing the offending YAML line:

image: "news_code/rss_img.png"

So perhaps from a different file that gets automatically rendered? Yep, I moved either of those files outside the Github repo cstories-app.github.io and ran to find out it that file renders fine independent of the website:

quarto::quarto_render("WST1_NC3-.qmd")

So then the issue is figuring out which QMDs are problematic. Ugh. Ok, wrote script to render each QMD outside repo and log status, then rename problematic files with an underscore prefix (_*) so it doesn't render automatically (per quarto.org/docs/websites/#render-targets).

bbest commented 1 year ago

Here's the core piece of code to check status of QMD:

https://github.com/cstories-app/cstories-app.github.io/blob/f928ce9a02027b94610114a13d476d63a4296161/_scripts/check_qmds.R#L31-L39

And then rename bad files:

https://github.com/cstories-app/cstories-app.github.io/blob/f928ce9a02027b94610114a13d476d63a4296161/_scripts/check_qmds.R#L75-L84

bbest commented 1 year ago

Rendered website OK, but slow with so many news QMDs. Background job from commit 9eb5c4d ended with:

[436/436] apps/triage.qmd

processing file: triage.qmd
  |......................................................................| 100%
   inline R code fragments

output file: triage.knit.md

Watching files for changes
Browse at http://localhost:4189/
GET: /
  /news/news_code/rss_img.png (404: Not Found)
GET: /
  /news/news_code/rss_img.png (404: Not Found)
bbest commented 1 year ago

Note problematic QMDs with unescaped quote marks as the problem:

https://github.com/cstories-app/cstories-app.github.io/blob/9eb5c4dbfaf84446d253f46cbc0f6db6e2ca4d2b/news/_BSF2_Tm-S.qmd#L1-L8

Fixed the rest in commit 780eed5 with following longer-term fix that I didn't yet try to run, so you'll want to test @jzadra:

https://github.com/cstories-app/cstories-app.github.io/blob/f1b23037cb0a3dc1090b665ea0598194a8a16375/news_code/news_rss.R#L117-L119