├── .gitignore ├── layouts └── partials │ ├── custom-header.html │ ├── highlight-style.html │ ├── logo.html │ ├── custom-footer.html │ ├── layout │ ├── theme.html │ └── javascript.html │ └── menu.html ├── static ├── images │ ├── favicon.png │ └── highlight.jpg ├── countdown-0.3.5 │ ├── smb_stage_clear.mp3 │ ├── countdown.css │ └── countdown.js └── css │ ├── theme-mine.css │ └── pygments.css ├── content ├── conclusion │ ├── _index.en.md │ └── slides │ │ ├── index.en.Rmd │ │ └── index.en.md ├── intro │ ├── _index.en.md │ ├── starters.en.md │ └── slides │ │ ├── index.en.Rmd │ │ └── index.en.md ├── promotion │ ├── _index.en.Rmd │ ├── _index.en.md │ ├── further-resources.en.md │ └── slides │ │ ├── index.en.Rmd │ │ └── index.en.md ├── others │ ├── _index.en.md │ ├── jekyll.en.md │ ├── diy.en.md │ ├── wix.en.md │ └── gatsby.en.md ├── noblog │ ├── _index.en.md │ ├── gistr.en.md │ └── devto.en.md ├── hugo │ ├── _index.en.Rmd │ ├── _index.en.md │ ├── demo │ │ ├── index.en.Rmd │ │ └── index.en.md │ ├── slides │ │ ├── index.en.Rmd │ │ └── index.en.md │ └── further-resources.en.md ├── reproducibility │ ├── _index.en.Rmd │ ├── _index.en.md │ ├── further-resources.en.md │ └── slides │ │ ├── index.en.Rmd │ │ └── index.en.md ├── distill │ ├── _index.en.Rmd │ ├── _index.en.md │ ├── demo │ │ ├── index.en.Rmd │ │ └── index.en.md │ ├── slides │ │ ├── index.en.Rmd │ │ └── index.en.md │ └── further-resources.en.md ├── webdev │ ├── _index.en.md │ ├── url.en.md │ ├── jamstack.en.md │ ├── css.en.md │ ├── hire.en.md │ ├── devtools.en.md │ └── playgrounds.en.md ├── wordpress │ ├── _index.en.Rmd │ ├── _index.en.md │ ├── demo │ │ ├── index.en.Rmd │ │ └── index.en.md │ ├── further-resources.en.md │ └── slides │ │ ├── index.en.Rmd │ │ └── index.en.md ├── _index.en.md ├── credits.en.md └── snippets.en.md ├── archetypes └── default.md ├── go.mod ├── test-course-site.Rproj ├── netlify.toml ├── go.sum ├── README.md └── config.toml /.gitignore: -------------------------------------------------------------------------------- 1 | .Rhistory 2 | .RData 3 | .Rproj.user 4 | node_modules 5 | public 6 | -------------------------------------------------------------------------------- /layouts/partials/custom-header.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maelle/rmd-blogging-course/HEAD/static/images/favicon.png -------------------------------------------------------------------------------- /layouts/partials/highlight-style.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/images/highlight.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maelle/rmd-blogging-course/HEAD/static/images/highlight.jpg -------------------------------------------------------------------------------- /content/conclusion/_index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Conclusion 3 | weight: 10 4 | slides: true 5 | --- 6 | 7 | Let's debrief! -------------------------------------------------------------------------------- /archetypes/default.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "{{ replace .Name "-" " " | title }}" 3 | date: {{ .Date }} 4 | draft: true 5 | --- 6 | 7 | -------------------------------------------------------------------------------- /static/countdown-0.3.5/smb_stage_clear.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maelle/rmd-blogging-course/HEAD/static/countdown-0.3.5/smb_stage_clear.mp3 -------------------------------------------------------------------------------- /layouts/partials/logo.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /content/intro/_index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Introduction 3 | weight: 1 4 | chapter: true 5 | slides: true 6 | menuTitle: Intro 7 | --- 8 | 9 | What do you need to know before this course? 10 | 11 | Why would you create a blog? -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module test-course-site 2 | 3 | go 1.14 4 | 5 | require ( 6 | github.com/dzello/reveal-hugo v0.0.0-20200513004858-ff9f389743ae // indirect 7 | github.com/matcornic/hugo-theme-learn v0.0.0-20200601144331-3efb32712c5c // indirect 8 | ) 9 | -------------------------------------------------------------------------------- /content/promotion/_index.en.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: Readers 3 | weight: 5 4 | chapter: true 5 | slides: true 6 | output: hugodown::md_document 7 | --- 8 | 9 | # Around readers 10 | 11 | A few tips about promoting your blog & interacting with readers. -------------------------------------------------------------------------------- /layouts/partials/custom-footer.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test-course-site.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | -------------------------------------------------------------------------------- /content/promotion/_index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Readers 3 | weight: 5 4 | chapter: true 5 | slides: true 6 | output: hugodown::md_document 7 | rmd_hash: 0b4574a0f75ea15b 8 | 9 | --- 10 | 11 | Around readers 12 | ============== 13 | 14 | A few tips about promoting your blog & interacting with readers. 15 | 16 | -------------------------------------------------------------------------------- /content/others/_index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Other website generators 3 | weight: 10 4 | --- 5 | 6 | You might prefer yet another solution! 7 | Note that if you use a website generator few other R users use, 8 | there will be 9 | 10 | * less tooling to go with it now, 11 | * less tooling for Rmd content migration from it in the future. -------------------------------------------------------------------------------- /content/others/jekyll.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Jekyll 3 | weight: 5 4 | --- 5 | 6 | Use [Jekyll](https://jekyllrb.com/) if you use Ruby a lot: this way you might like it, and not be scared 7 | by the installation of gems. 8 | 9 | {{% notice info %}} 10 | Documentation of [Jekyll support in the blogdown package](https://bookdown.org/yihui/blogdown/jekyll.html). 11 | {{% /notice %}} -------------------------------------------------------------------------------- /content/noblog/_index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: No blog? 3 | weight: 20 4 | --- 5 | 6 | How to share content without having a blog? 7 | 8 | A downside of the solutions is that you don't own your platform. 9 | 10 | Another downside is that these are platforms for tech blogging rather than _scientific_ blogging per se. 11 | 12 | In all cases remember to promote your content, even if there is no RSS feed! -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | publish = "/public" 3 | command = "hugo -d public" 4 | 5 | [context.production.environment] 6 | HUGO_VERSION = "0.73.0" 7 | GO_VERSION="1.12" 8 | 9 | [context.deploy-preview.environment] 10 | HUGO_VERSION = "0.73.0" 11 | GO_VERSION="1.12" 12 | 13 | 14 | [context.branch-deploy] 15 | command = "hugo --gc -b $DEPLOY_PRIME_URL" 16 | 17 | [context.deploy-preview] 18 | command = "hugo --gc -b $DEPLOY_PRIME_URL" -------------------------------------------------------------------------------- /content/hugo/_index.en.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: Hugo 3 | weight: 3 4 | chapter: true 5 | slides: true 6 | output: hugodown::md_document 7 | --- 8 | 9 | We'll explore [Hugo](https://gohugo.io/documentation/) with [hugodown](https://hugodown.r-lib.org/). 10 | 11 | Note that Hugo changes fast. Exciting (more features!) and scary (broken websites). 12 | 13 | The hugodown package is itself an experimental R package, but it pins a Hugo version to projects. -------------------------------------------------------------------------------- /content/reproducibility/_index.en.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: Reproducibility 3 | weight: 4 4 | chapter: true 5 | slides: true 6 | output: hugodown::md_document 7 | --- 8 | 9 | # Reproducibility 10 | 11 | We're all about transparency and reproducibility but are your blog posts supposed to be perfectly encapsulated reproducible analyses? 12 | 13 | Spoiler: probably not; but there are less ambitious steps that are important. 14 | Indicate session info and data origin, backup, take notes. -------------------------------------------------------------------------------- /content/hugo/_index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Hugo 3 | weight: 3 4 | chapter: true 5 | slides: true 6 | output: hugodown::md_document 7 | rmd_hash: b6610e2d051f0155 8 | 9 | --- 10 | 11 | We'll explore [Hugo](https://gohugo.io/documentation/) with [hugodown](https://hugodown.r-lib.org/). 12 | 13 | Note that Hugo changes fast. Exciting (more features!) and scary (broken websites). 14 | 15 | The hugodown package is itself an experimental R package, but it pins a Hugo version to projects. 16 | 17 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/dzello/reveal-hugo v0.0.0-20200513004858-ff9f389743ae h1:x2cMxkgkOshGVuUswcYK1Nda6s0QFff8QDOIt3eCfKA= 2 | github.com/dzello/reveal-hugo v0.0.0-20200513004858-ff9f389743ae/go.mod h1:0S5eDEdHBx8tSj8veo9lUnuJRXa8WqmpANd0Lz7CLc8= 3 | github.com/matcornic/hugo-theme-learn v0.0.0-20200601144331-3efb32712c5c h1:xPoHdfS2a/O/6q4LuhMtusqa6hP5f69d6LwiyfvkDfE= 4 | github.com/matcornic/hugo-theme-learn v0.0.0-20200601144331-3efb32712c5c/go.mod h1:YoToDcvQxmAFhpEuapKUysBDEBckqDEssqTrmeZ2+uY= 5 | -------------------------------------------------------------------------------- /content/distill/_index.en.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: Distill 3 | weight: 3 4 | chapter: true 5 | slides: true 6 | output: hugodown::md_document 7 | --- 8 | 9 | [Distill](rstudio.github.io/distill/) is both a framework and an R package. 10 | 11 | Its docs state: 12 | 13 | > Distill for R Markdown is a web publishing format optimized for scientific and technical communication. 14 | 15 | It has both an R Markdown output format, and handy functions such as `distill::create_post()`. 16 | 17 | Let's explore it! -------------------------------------------------------------------------------- /content/reproducibility/_index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Reproducibility 3 | weight: 4 4 | chapter: true 5 | slides: true 6 | output: hugodown::md_document 7 | rmd_hash: f388f66391e3a783 8 | 9 | --- 10 | 11 | Reproducibility 12 | =============== 13 | 14 | We're all about transparency and reproducibility but are your blog posts supposed to be perfectly encapsulated reproducible analyses? 15 | 16 | Spoiler: probably not; but there are less ambitious steps that are important. Indicate session info and data origin, backup, take notes. 17 | 18 | -------------------------------------------------------------------------------- /content/webdev/_index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Web development resources 3 | menuTitle: Web dev 4 | weight: 100 5 | --- 6 | 7 | Some resources around web development that I found interesting. 8 | 9 | You might need to learn more about web development to 10 | 11 | * tweak things yourself; 12 | * learn the language of the web developer you hire. 13 | 14 | For fun, I recommend reading [the dev.to post "How to build a website in 2020"](https://dev.to/thegreengreek/how-to-build-a-website-in-2020-4f0m) ([more about dev.to as a blogging platform](/noblog/devto/)). -------------------------------------------------------------------------------- /content/webdev/url.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Domain 3 | weight: 2 4 | --- 5 | 6 | Having your own domain is in my opinion a great idea as opposed to depending on a commercial platform / your employer. 7 | 8 | + Search for "custom domain + tool you're using for deploying your website". 9 | 10 | + Follow instructions. 11 | 12 | + Be patient, there are things like caches etc. so it might take time until it works. 13 | 14 | + Read funny and useful posts like [Custom domain hosting with Github and Namecheap](https://blog.brooke.science/posts/custom-domain-hosting-with-github-and-namecheap/) -------------------------------------------------------------------------------- /content/distill/_index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Distill 3 | weight: 3 4 | chapter: true 5 | slides: true 6 | output: hugodown::md_document 7 | rmd_hash: eac431401cb5fb0a 8 | 9 | --- 10 | 11 | [Distill](rstudio.github.io/distill/) is both a framework and an R package. 12 | 13 | Its docs state: 14 | 15 | > Distill for R Markdown is a web publishing format optimized for scientific and technical communication. 16 | 17 | It has both an R Markdown output format, and handy functions such as [`distill::create_post()`](https://rdrr.io/pkg/distill/man/create_post.html). 18 | 19 | Let's explore it! 20 | 21 | -------------------------------------------------------------------------------- /content/noblog/gistr.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: GitHub gists 3 | weight: 7 4 | --- 5 | 6 | You can post short snippets, images, etc. to [GitHub gists](https://gist.github.com/). 7 | 8 | You can even use the [`gistr` package by Scott Chamberlain](https://docs.ropensci.org/gistr/). 9 | 10 | However contrary to dev.to gists are not really, at least in my experience, a platform where people go discover content. 11 | Therefore you might want to list gists from somewhere else. 12 | A portfolio (so a blog after all, ah! Hugo [lets you easily embed gists](https://gohugo.io/content-management/shortcodes/#gist)), a tweet (ephemerous attention). -------------------------------------------------------------------------------- /content/webdev/jamstack.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: JAMStack 3 | weight: 60 4 | --- 5 | 6 | [JAMStack](https://jamstack.org/) (JavaScript, APIs, Markup) is a way to build website created & promoted by the company Netlify. 7 | From what I understand all three things shown in this course are more or less JAMStack (WordPress is not a part of the JAMStack but I've seen WordPress REST API [called "headless WordPress" and classified as JAMStack CMS](https://jamstack.wtf/#cms) :shrug:) 8 | 9 | You might find [jamstack.org](https://jamstack.org) and [jamstack.wtf](https://jamstack.wtf/) interesting for your own learning or for better interacting with web developers you might hire. -------------------------------------------------------------------------------- /content/webdev/css.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CSS 3 | weight: 5 4 | --- 5 | 6 | [An allegory for my tweaking CSS](https://www.theguardian.com/artanddesign/2020/jun/22/experts-call-for-regulation-after-latest-botched-art-restoration-in-spain) :grin: 7 | 8 | More seriously, I'm linking to good resources I have clearly not explored enough yet. :grimacing: 9 | 10 | {{< tweet 1278052903744344064 >}} 11 | 12 | * [Learn to style HTML using CSS](https://developer.mozilla.org/en-US/docs/Learn/CSS) 13 | 14 | * [CSS-Tricks](https://css-tricks.com/) 15 | 16 | * [Resilient CSS YouTube series by Jen Simmons](https://www.youtube.com/watch?v=u00FY9vADfQ) 17 | 18 | {{< tweet 1245391028795965442 >}} 19 | 20 | -------------------------------------------------------------------------------- /content/webdev/hire.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Not yourself? 3 | weight: 2 4 | --- 5 | 6 | In the intro I mentioned that your blogging framework should be either fit in your workflow or use tools that you want to invest time in. 7 | 8 | If you want tweaks compared to default themes, you might need to hire a web developer / designer. 9 | There are also companies providing themes with support (so not tweaked). 10 | 11 | I'm not advertising for anything in particular, just reminding you that time is money or at least a finite resource. :wink: 12 | 13 | I don't have good tips for how to choose a web development company/person apart from knowing what you want and need (if you know Hugo templating, maybe you just need HTML+JS+CSS, for instance). -------------------------------------------------------------------------------- /content/noblog/devto.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: dev.to 3 | weight: 5 4 | --- 5 | 6 | [Some](https://twitter.com/_ColinFay/status/1260580782181056514) [folks](https://twitter.com/juliasilge/status/1260580363971317765) with a blog use [dev.to](https://dev.to/) to _repost_ their content from their RSS feed. 7 | 8 | You could also use your [dev.to](https://dev.to/faq) profile as your only medium! 9 | 10 | Dave Parr wrote a blog post [Posting from .Rmd to dev.to](https://dev.to/daveparr/posting-from-rmd-to-dev-to-5gld) and an [**R package** to help you post from Rmd to dev.to](https://github.com/DaveParr/dev.to.ol)! 11 | 12 | Dave Parr also wrote an exciting post ["I made my dev.to content into a website to find a new job"](https://dev.to/daveparr/i-made-my-dev-to-content-into-a-website-to-find-a-new-job-2kn5). -------------------------------------------------------------------------------- /content/wordpress/_index.en.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: WordPress 3 | weight: 3 4 | chapter: true 5 | slides: true 6 | output: hugodown::md_document 7 | --- 8 | 9 | # WordPress 10 | 11 | First of all, no shame! 12 | 13 | `r hugodown::embed_tweet("1259058742513012736")` 14 | 15 | ## Our challenge 16 | 17 | How to publish your R Markdown posts to a WordPress website without copy-pasting?[^cp] 18 | 19 | The only modern solution is to my knowledge, my [own WIP package `goodpress`](https://github.com/maelle/goodpress). I'll explain a few setup steps on your website, and how to organize your posts to publish them with `goodpress::wp_post()`, if you're brave enough for using my tool. :wink: 20 | 21 | [^cp]: Copy-pasting is ok, [the pros do it](https://twitter.com/gvwilson/status/1274324689322741760); it's just not the vibe of this course. -------------------------------------------------------------------------------- /content/others/diy.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Build your own site generator? 3 | menuTitle: DIY 4 | weight: 100 5 | --- 6 | 7 | Now say that like my colleague Mark you like programming and find a website framework that you like. 8 | 9 | How about building your own site generator? 10 | 11 | Read [how Mark created his own R-based site generator using Zurb Foundation as a powerful templating tool](https://mpadge.github.io/blog/blog001.html). 12 | 13 | For further inspiration, since the distill package is also an R-based site generator, you could have a look at [its source](http://github.com/rstudio/distill), in particular how it makes the most of [R Markdown websites](https://bookdown.org/yihui/rmarkdown/rmarkdown-site.html). You could also inspect the [pull request that added an R Markdown site generator for hugodown sites to hugodown](https://github.com/r-lib/hugodown/pull/52). 14 | -------------------------------------------------------------------------------- /content/webdev/devtools.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: DevTools 3 | weight: 7 4 | --- 5 | 6 | In the distill demo if all goes well I'll have shown the web developer console in Firefox. 7 | Chrome has a web developer console too. 8 | 9 | Here are more resources about it thanks to [Bob Rudis](https://twitter.com/hrbrmstr/status/1272484048980578307) and [timelyportfolio](https://twitter.com/timelyportfolio/status/1272500040637059072) 10 | 11 | * [Official Google DevTools Docs](https://developers.google.com/web/tools/chrome-devtools/) 12 | 13 | * [Khan Academy](https://khanacademy.org/computing/computer-programming/html-css/web-development-tools/a/using-the-browser-developer-tools) 14 | 15 | * [Lifewire DevTools How-To](https://lifewire.com/web-browser-developer-tools-3988965) 16 | 17 | * [Designing in the Browser](https://www.youtube.com/playlist?list=PLNYkxOF6rcIDI0QtJvW6vKonTxn6azCsD) -------------------------------------------------------------------------------- /content/others/wix.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Wix, Squarespace? 3 | menuTitle: Wix &co 4 | weight: 200 5 | --- 6 | 7 | What about other services for building websites like Wix? 8 | 9 | First, be careful you can export your content safely and easily before you commit to a website service. 10 | 11 | Now for being able to use a workflow like the one we introduced with [`goodpress` for WordPress](https://github.com/maelle/goodpress/) you need 12 | 13 | * the service to provide an API for publishing new posts and managing media (listing, deleting, uploading); 14 | 15 | * to know what format the R Markdown output should have. 16 | 17 | Then you'd need to write a script/package around that, using HTTP packages, rmarkdown, Pandoc, etc. 18 | 19 | OR you could figure out what R Markdown output format to use and copy-paste to the post editor, and upload media by hand + tweak references to media path in the output. -------------------------------------------------------------------------------- /content/reproducibility/further-resources.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: More about reproducibility 3 | menuTitle: Further resources 4 | weight: 50 5 | --- 6 | 7 | Not specific to blogging. 8 | 9 | + [Reproducible Research Data & Project Management in R](https://annakrystalli.me/rrresearchACCE20/) 10 | 11 | + [A guide to modern reproducible data science with R](https://rstudio.com/resources/rstudioconf-2019/a-guide-to-modern-reproducible-data-science-with-r-karthik-ram/) 12 | 13 | + [A guide to reproducible code, British Ecological Society](http://www.britishecologicalsociety.org/wp-content/uploads/2017/12/guide-to-reproducible-code.pdf) 14 | 15 | + [How to Make a Reproducible Paper - slides](https://bit.ly/repro_vid), [code](https://github.com/ablucher/Workshop_ReproduciblePaper) 16 | 17 | + [How to make a reproducible version of your R analysis that can be run in a web browser](https://www.youtube.com/watch?v=wSkheV-Uqq4&feature=youtu.be) -------------------------------------------------------------------------------- /content/wordpress/_index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: WordPress 3 | weight: 3 4 | chapter: true 5 | slides: true 6 | output: hugodown::md_document 7 | rmd_hash: b6188ee88187119c 8 | 9 | --- 10 | 11 | WordPress 12 | ========= 13 | 14 | First of all, no shame! 15 | 16 | {{< tweet 1259058742513012736 >}} 17 | 18 | Our challenge 19 | ------------- 20 | 21 | How to publish your R Markdown posts to a WordPress website without copy-pasting?[^1] 22 | 23 | The only modern solution is to my knowledge, my [own WIP package `goodpress`](https://github.com/maelle/goodpress). I'll explain a few setup steps on your website, and how to organize your posts to publish them with [`goodpress::wp_post()`](https://rdrr.io/pkg/goodpress/man/wp_post.html), if you're brave enough for using my tool. :wink: 24 | 25 | [^1]: Copy-pasting is ok, [the pros do it](https://twitter.com/gvwilson/status/1274324689322741760); it's just not the vibe of this course. 26 | 27 | -------------------------------------------------------------------------------- /content/wordpress/demo/index.en.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: Notes from the demo 3 | menuTitle: Demo 4 | weight: 5 5 | slides: true 6 | output: hugodown::md_document 7 | --- 8 | 9 | - setup (on the WordPress side, in .Renviron) was discussed on the slides, see [goodpress setup vignette](https://maelle.github.io/goodpress/articles/setup.html) 10 | 11 | - install the remotes package, `install.packages("remotes")` 12 | 13 | - install the goodpress package, `remotes::install_github("maelle/goodpress", ref = "main")` 14 | 15 | - create a folder, possibly a subfolder in a folder called "my-wordpress-posts" or so, "2020-07-03-cool-post". 16 | 17 | - in that folder, create index.Rmd. 18 | 19 | - in index.Rmd, paste [example content](/snippets/#goodpress-post). look at the YAML field, see also [goodpress usage vignette](https://maelle.github.io/goodpress/articles/goodpress.html) 20 | 21 | - knit. 22 | 23 | - use `goodpress::wp_post("2020-07-03-cool-post")` -------------------------------------------------------------------------------- /content/_index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Scientific Rmd Blogging" 3 | --- 4 | 5 | # Scientific Blogging with R Markdown 6 | 7 | Are you an R user who works in science? Would you like sharing more 8 | online? How about starting a new blog, with R Markdown (Rmd)? 9 | 10 | In this 11 | 2-hour course with live coding, we'll go on three short adventures: 12 | 13 | - setting up a scientific Rmd blog with the Distill framework and the 14 | distill package 15 | 16 | - setting up a scientific Rmd blog with the Hugo website generator and 17 | the hugodown package 18 | 19 | - adding Rmd posts to a Wordpress blog. 20 | 21 | We'll prepare for the adventures by defining what we expect of an Rmd blog. 22 | We'll end the course by reflecting on each adventure as well as 23 | mentioning important future paths such as how to promote your blog. 24 | You should leave the course ready to start a scientific R Markdown blog 25 | with your tool of choice, and knowing where to find more resources and help. -------------------------------------------------------------------------------- /content/webdev/playgrounds.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Playgrounds 3 | weight: 55 4 | --- 5 | 6 | With web development as with many other things being able to experiment increases your chance to solve a problem, like [reprex](https://reprex.tidyverse.org/) for R. 7 | 8 | * Create a new distill/Hugo website and play in it. You might like this [Lorem Ipsum Hugo shortcode](https://www.giffgaff.io/tech/lorem-ipsum-shortcode-for-hugo/). 9 | 10 | * Create a free wordpress.com website (with which you cannot use goodpress, though), or some other sort of throw away Wordpress instance. 11 | 12 | * For HTML+JS+CSS independently from website generation, use a code playground such as [CodePen](https://codepen.io/) (or [build your own for blog posts](https://masalmon.eu/2020/04/21/css-snippet/) :smile_cat:). 13 | 14 | * For sketching layouts apart from drawing on paper :grin: there are tools like [Figma](https://www.figma.com/) (that has a free version) and [Sketch](https://www.sketch.com/) (macOS only, no free version). -------------------------------------------------------------------------------- /content/intro/starters.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Before blogging 3 | weight: 5 4 | --- 5 | 6 | * In this course I expect some familiarity with R Markdown. Only the basics, some of you discovered R Markdown _yesterday_! 7 | 8 | * I use the usethis package a lot :robot: :sparkles:, and recommend doing so. Follow [usethis setup article](https://usethis.r-lib.org/articles/articles/usethis-setup.html) in particular [_"Use usethis or devtools in interactive work"_](https://usethis.r-lib.org/articles/articles/usethis-setup.html#use-usethis-or-devtools-in-interactive-work-1) and the Git/GitHub stuff. 9 | 10 | * If you use GitLab, not GitHub, you can follow [Heidi Seibold's instructions _"Setup Git RStudio GitLab"_](https://gitlab.com/HeidiSeibold/setup-git-rstudio-gitlab). There is no helper similar to `usethis::use_github()` to my knowledge. 11 | 12 | * You should be able to follow the course and manage a blog without any git knowledge. Now for later, if you feel curious about version control, I'd recommend checking out [happygitwithr.com](https://happygitwithr.com/) and [Suzan Baert's blog post about git](https://suzan.rbind.io/2018/03/reflections-4-months-of-github/). -------------------------------------------------------------------------------- /content/wordpress/demo/index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Notes from the demo 3 | menuTitle: Demo 4 | weight: 5 5 | slides: true 6 | output: hugodown::md_document 7 | rmd_hash: af15b37e8ed932b0 8 | 9 | --- 10 | 11 | - setup (on the WordPress side, in .Renviron) was discussed on the slides, see [goodpress setup vignette](https://maelle.github.io/goodpress/articles/setup.html) 12 | 13 | - install the remotes package, [`install.packages("remotes")`](https://rdrr.io/r/utils/install.packages.html) 14 | 15 | - install the goodpress package, [`remotes::install_github("maelle/goodpress", ref = "main")`](https://remotes.r-lib.org/reference/install_github.html) 16 | 17 | - create a folder, possibly a subfolder in a folder called "my-wordpress-posts" or so, "2020-07-03-cool-post". 18 | 19 | - in that folder, create index.Rmd. 20 | 21 | - in index.Rmd, paste [example content](/snippets/#goodpress-post). look at the YAML field, see also [goodpress usage vignette](https://maelle.github.io/goodpress/articles/goodpress.html) 22 | 23 | - knit. 24 | 25 | - use [`goodpress::wp_post("2020-07-03-cool-post")`](https://maelle.github.io/goodpress//reference/wp_post.html) 26 | 27 | -------------------------------------------------------------------------------- /content/credits.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Credits 3 | disableToc: true 4 | --- 5 | 6 | Thank you! 7 | 8 | ## Funding 9 | 10 | The first version of this workshop is supported by the German Federal Ministry of Education and Research as part of [a series of 3 workshops on research data management](https://wiho-fdm.github.io/). 11 | 12 | ## Hugo experts 13 | 14 | Fellow Hugo fans, who taught me a lot via their public materials and useful convos! 15 | 16 | * [Alison Hill](https://alison.rbind.io/) -- see for instance [her webinar with Desirée De Leon about "Sharing on Short Notice"](https://education.rstudio.com/blog/2020/04/sharing-on-short-notice/) 17 | * [Steph Locke](https://twitter.com/TheStephLocke) 18 | * [Lukas Burk](https://blog.jemu.name/) 19 | 20 | ## Wordpress expert 21 | 22 | * [Sébastien Rochette](https://statnmap.com/) who answered [Wordpress questions](https://twitter.com/ma_salmon/status/1263448146610438145) and actually also helped me with Hugo, directly, and [indirectly](https://github.com/matcornic/hugo-theme-learn/issues/187#issuecomment-461173989). 23 | 24 | ## Tooling 25 | 26 | * [Netlify](https://www.netlify.com) - Continuous deployement and hosting of this documentation 27 | * [Hugo](https://gohugo.io/) 28 | * [Hugo theme learn](https://github.com/matcornic/hugo-theme-learn) 29 | * [Hugo theme reveal-hugo](https://github.com/dzello/reveal-hugo) 30 | * [hugodown](https://github.com/r-lib/hugodown/) 31 | -------------------------------------------------------------------------------- /content/others/gatsby.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Gatsby 3 | weight: 55 4 | --- 5 | 6 | Hugo is powered by Go, Jekyll by Ruby, [Gatsby](https://www.gatsbyjs.org/) by React. 7 | Gatsby lets you use GraphQL to flexibly render your content (a special listing page for instance). 8 | So if you like either React or GraphQL or want to learn them, check out Gatsby! 9 | 10 | {{% notice info %}} 11 | Robert Myles wrote a [tool for .Rmd to .mdx](https://github.com/RobertMyles/writeMDX), 12 | introduced in the blog post [From R to Gatsby](https://www.robertmylesmcdonnell.com/content/posts/rtogatsby/). [Source of Robert Myles' website](https://github.com/RobertMyles/site). 13 | {{% /notice %}} 14 | 15 | Example of other websites: 16 | 17 | * [ggplot2tor](https://ggplot2tor.com/) 18 | 19 | * [Krist Wongsuphasawat's website](https://kristw.yellowpigz.com/) 20 | 21 | * [Ben Lindsay's website](https://benjlindsay.com/) 22 | 23 | * [Neal Grantham's website](https://www.nsgrantham.com/) 24 | 25 | * [openFDA](https://open.fda.gov/), [source](https://github.com/FDA/open.fda.gov) 26 | 27 | Not R related but interesting read: [Migrating to Gatsby](https://czep.net/20/gatsby-migration.html) by Scott Czepiel. 28 | 29 | Last point, I read in a [post on RStudio Education blog](https://education.rstudio.com/blog/2020/05/teach-interactive-course/) that Gatsby is part of what powers [the course framework created by Ines Montani](https://github.com/ines/course-starter-r). -------------------------------------------------------------------------------- /content/wordpress/further-resources.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: More about WordPress & goodpress 3 | menuTitle: Further resources 4 | weight: 50 5 | --- 6 | 7 | ## Read the manual :wink: 8 | 9 | * [goodpress docs](https://maelle.github.io/goodpress/) 10 | 11 | * Read about WordPress in your usual WordPress channels. 12 | And contribute good WordPress general resources to this repo. :wink: 13 | 14 | It's good to know how your website infrastructure evolves and works. 15 | 16 | ## Follow development :eyes: and contribute to goodpress&pressur! 17 | 18 | I have shown all there is to [`goodpress`](https://github.com/maelle/goodpress), if you want more you might contribute 19 | 20 | * with bug reports, feature requests; 21 | 22 | * with code and docs. 23 | 24 | I'd be glad to help you with R package development tips if you feel you're a n00b. 25 | 26 | Also follow [pressur development](https://github.com/hrbrmstr/pressur)! 27 | 28 | ## Where to get help? :wave: 29 | 30 | * [goodpress issue tracker](https://github.com/maelle/goodpress/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) 31 | 32 | * About WordPress itself, [WordPress forums](https://wordpress.org/support/forums/) 33 | 34 | ## Migrate your content to a static website? 35 | 36 | No judgement on your using WordPress, of course! Keep going! :rocket: 37 | 38 | But now that your posts are neatly organized in folders they'd be easier to migrate than if they were scattered. 39 | Hugo docs in particular have [a section about migrating to Hugo from WordPress](https://gohugo.io/tools/migrations/). -------------------------------------------------------------------------------- /content/reproducibility/slides/index.en.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | outputs: 3 | - Reveal 4 | title: Workflows 5 | hidden: true 6 | layout: list 7 | weight: 1 8 | output: hugodown::md_document 9 | --- 10 | 11 | # Reproducibility? 12 | 13 | Should your blog posts still be "knittable?" 14 | 15 | --- 16 | 17 | # Reproducibility? 18 | 19 | * Be able to update your post short/medium term 20 | 21 | * Same for readers except for private data 22 | 23 | {{% fragment %}} 24 |
25 | But blog posts will **age**, which is fine, a blog is not a current docs website. 26 | {{% /fragment %}} 27 | 28 | --- 29 | 30 | # All posts 31 | 32 | Need to re-knit posts for migration, tool updates? 33 | 34 | {{% fragment %}} 35 | Or use the R Markdown output after a point (.md), potentially with YAML/other tweaks. 36 | 37 | When I migrated from Jekyll to Hugo I used the .md, not .Rmd. 38 | {{% /fragment %}} 39 | 40 | --- 41 | 42 | # Evergreen posts 43 | 44 | If you want a tutorial to be evergreen you'll need to ensure it works with the latest packages etc. 45 | 46 | But are tutorials like package vignettes? 47 | 48 | --- 49 | 50 | # Reproducible analyses 51 | 52 | How to archive your computing environment? 53 | 54 | It might be "easier" to archive the analysis elsewhere (tools for scientific articles) and link to that from the blog post. 55 | 56 | --- 57 | 58 | # Transparency 59 | 60 | For you, for readers. 61 | 62 | * Add session info to bottom of posts 63 | 64 | * Mention data origin (URL to data?) 65 | 66 | --- 67 | 68 | # Common sense 69 | 70 | * Backup 71 | 72 | * Make note of anything that might be tricky (dev version of a package) 73 | 74 | --- 75 | 76 | # What's your own take? 77 | 78 | -------------------------------------------------------------------------------- /static/countdown-0.3.5/countdown.css: -------------------------------------------------------------------------------- 1 | .countdown { 2 | background: inherit; 3 | position: absolute; 4 | cursor: pointer; 5 | font-size: 3em; 6 | line-height: 1; 7 | border-color: #ddd; 8 | border-width: 3px; 9 | border-style: solid; 10 | border-radius: 15px; 11 | box-shadow: 0px 4px 10px 0px rgba(50, 50, 50, 0.4); 12 | -webkit-box-shadow: 0px 4px 10px 0px rgba(50, 50, 50, 0.4); 13 | margin: 0.6em; 14 | padding: 10px 15px; 15 | text-align: center; 16 | } 17 | .countdown { 18 | display: flex; 19 | align-items: center; 20 | justify-content: center; 21 | } 22 | .countdown .countdown-time { 23 | background: none; 24 | font-size: 100%; 25 | padding: 0; 26 | } 27 | .countdown-digits { 28 | color: inherit; 29 | } 30 | .countdown.running { 31 | border-color: #3C9A5F; 32 | background-color: #43AC6A; 33 | } 34 | .countdown.running .countdown-digits { 35 | color: #102B1A; 36 | } 37 | .countdown.finished { 38 | border-color: #D83A20; 39 | background-color: #F04124; 40 | } 41 | .countdown.finished .countdown-digits { 42 | color: #3C1009; 43 | } 44 | .countdown.running.warning { 45 | border-color: #CFAE24; 46 | background-color: #E6C229; 47 | } 48 | .countdown.running.warning .countdown-digits { 49 | color: #39300A; 50 | } 51 | 52 | @-webkit-keyframes blink { 53 | from {opacity: 1} 54 | 50% {opacity: 0.1} 55 | to {opacity: 1} 56 | } 57 | 58 | @keyframes blink { 59 | from {opacity: 1} 60 | 50% {opacity: 0.1} 61 | to {opacity: 1} 62 | } 63 | 64 | .countdown.running.blink-colon .countdown-digits.colon { 65 | -webkit-animation: blink 2s steps(1, end) 0s infinite; 66 | animation: blink 2s steps(1, end) 0s infinite; 67 | } 68 | -------------------------------------------------------------------------------- /content/distill/demo/index.en.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: Notes from the demo 3 | menuTitle: Demo 4 | weight: 5 5 | slides: true 6 | output: hugodown::md_document 7 | --- 8 | 9 | - show the RStudio IDE, ask whether anyone is unfamiliar with it. 10 | 11 | - install the distill package, `install.packages("distill")` 12 | 13 | - create blog (from RStudio Create New Project, not `distill::create_blog()`). 14 | 15 | - what's in the folder now? 16 | 17 | - show website in local browser. 18 | 19 | - `usethis::use_git()` 20 | 21 | - change site but not URL, and about. change citations: true!!! 22 | 23 | - rebuild the site via RStudio build button or `rmarkdown::render_site()`. 24 | 25 | - show website in local browser. 26 | 27 | - edit and knit welcome. including author info!! 28 | 29 | - look what changed, commit 30 | 31 | - show website in local browser. 32 | 33 | - look at post html in _posts and _site. mention navbar 34 | 35 | - commit 36 | 37 | - add a post with `distill::create_post()`. knit, look what changed this time. 38 | 39 | - add references 40 | 41 | - add latex, mention JavaScript 42 | 43 | - add footnote and aside 44 | 45 | - put website online via Netlify drag and drop. 46 | 47 | - add base_url to site config, show citations metadata is added. 48 | 49 | - Netlify drag and drop. 50 | 51 | - Some minimal styling. Introduce the web developer console. 52 | 53 | - Netlify drag and drop 54 | 55 | - GitHub repo `usethis::use_github()` 56 | 57 | - mention git checkout -b and [the distill docs about blog post workflows](https://rstudio.github.io/distill/blog_workflow.html). 58 | 59 | - Other options for deployment (Netlify link to repo, [distill docs](https://rstudio.github.io/distill/publish_website.html)) 60 | 61 | - add Twitter&GitHub -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Scientific blogging with R Markdown 3 | 4 | 5 | [![Netlify Status](https://api.netlify.com/api/v1/badges/87a90f80-f65e-4bac-9e50-2ffa6ab8936a/deploy-status)](https://app.netlify.com/sites/scientific-rmd-blogging/deploys) 6 | [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) 7 | 8 | 9 | Source of the website of a short course. 10 | 11 | It is powered by [Hugo](https://gohugo.io/) and the following themes: 12 | 13 | * [Hugo theme learn](https://github.com/matcornic/hugo-theme-learn) 14 | * [Hugo theme reveal-hugo](https://github.com/dzello/reveal-hugo) 15 | 16 | Slides for each section are listed in the menu and opened in a new tab (thanks to a [custom menu layout](/blob/master/layouts/partials/menu.html), compared to the original Hugo learn theme). 17 | 18 | Some Markdown content is generated with [R Markdown](https://rmarkdown.rstudio.com/), using [hugodown](https://github.com/r-lib/hugodown/). 19 | 20 | The website is deployed by [Netlify](https://www.netlify.com/). 21 | 22 | Slides could be printed to PDF using Decktape which I [have done in a concept](https://github.com/maelle/test-course-site) but I am not pursuing it further. 23 | 24 | ### Why these tools? 25 | 26 | Why use Hugo for both the website and slidedecks, and not, say Hugo+hugodown for pages and xaringan for slides? 27 | This way the source of slides is html produced by Hugo from Markdown content. 28 | It allows me to use: 29 | 30 | * downlit syntax highlighting for slides created from R Markdown with hugodown output format; 31 | * Chroma syntax highlighting for other languages; 32 | * emojis! `:grin:` works in slides; 33 | * Shortcodes in slides, should I choose to. 34 | 35 | Also, because slides are in the content, they are indexed by the Hugo learn theme so searchable! 36 | 37 | -------------------------------------------------------------------------------- /content/promotion/further-resources.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: More about readers 3 | menuTitle: Further resources 4 | weight: 50 5 | --- 6 | 7 | ## Promotion 8 | 9 | * [My blog post "Get on your soapbox! R blog content and promotion"](https://masalmon.eu/2018/07/16/soapbox/) 10 | 11 | * [How to have (my) content shared by R Weekly?](https://github.com/rweekly/rweekly.org#how-to-have-my-content-shared-by-r-weekly) 12 | 13 | * Look into how to add a (category specific) RSS feed to your blog, if there's not one by default. For R Bloggers, that feed needs to feature the full content of posts. 14 | 15 | ## Comments 16 | 17 | * [My blog post about utteranc.es](https://masalmon.eu/2019/10/02/disqus/) (which means you need to use GitHub...) 18 | 19 | * [Schnack, a simple Disqus-like drop-in commenting system written in JavaScript.](https://github.com/schn4ck/schnack) read about [in a post of Noam Ross'](https://www.noamross.net/2019/08/09/a-new-website/) 20 | 21 | * Not very recent but useful [ Blog comment systems: Disqus alternatives](https://fedidat.com/530-blog-comments/) 22 | 23 | * In WordPress, built-in. 24 | 25 | 26 | ## Citations 27 | 28 | * [Hugo template for adding citation metadata to posts by Sébastien Rochette](https://github.com/statnmap/hugo-statnmap-theme/blob/3e2a54a9836fdd65779865e91058ba304b628336/layouts/partials/citation.html) 29 | 30 | * [DOI for blog posts?](https://blog.datacite.org/schema-org-register-dois/) 31 | 32 | ## Analytics 33 | 34 | If you use another service than Google Analytics, I'd be glad to hear about your experience. 35 | 36 | ## Negative feedback 37 | 38 | * The topic of negative feedback is mentioned in [The Ladybug podcast about Blogging](https://www.ladybug.dev/episodes/blogging-101?rq=blogging) 39 | 40 | * Twitter [soft block](https://www.urbandictionary.com/define.php?term=Soft%20Block). You can also _mute_ accounts. 41 | 42 | * When you are wrong, don't get defensive. Thread below. 43 | 44 | {{< tweet 1275485736259792898 >}} 45 | -------------------------------------------------------------------------------- /content/conclusion/slides/index.en.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | outputs: 3 | - Reveal 4 | title: Conclusion 5 | hidden: true 6 | layout: list 7 | weight: 1 8 | output: hugodown::md_document 9 | --- 10 | 11 | # Scientific blogging with R Markdown 12 | 13 | :sob: Nearly time to say goodbye! 14 | 15 | --- 16 | 17 | * distill: perfect, not flexible 18 | 19 | * Hugo&hugodown: very flexible (too flexible?), changes fast, experimental R package 20 | 21 | * WordPress&goodpress: also flexible, even more experimental R package 22 | 23 | --- 24 | 25 | # What to choose 26 | 27 | * distill 28 | 29 | * Hugo Academic with `hugodown::create_site_academic()` 30 | 31 | * WordPress if you already use WordPress? 32 | 33 | --- 34 | 35 | # What to choose 36 | 37 | Start by playing! Don't commit right away. 38 | 39 | Does any of you want to say what they'd choose and why? 40 | 41 | --- 42 | 43 | # True for all 44 | 45 | * Read the docs and follow development! :eyes: 46 | 47 | * Backup! :warning: 48 | 49 | --- 50 | 51 | # Change your mind? 52 | 53 | * Migration tools 54 | 55 | * `yaml`, `commonmark` packages, etc. 56 | 57 | * Redirects! URLs are important. 404 page. 58 | 59 | --- 60 | 61 | # Have fun! 62 | 63 | If you're worried about blogging, find a blogging buddy to read your drafts? 64 | 65 | Make efforts but don't be perfectionist. 66 | 67 | --- 68 | 69 | # Setup is not fun 70 | 71 | * With R helper packages, setup is smoother 72 | 73 | * But in general setup = learning a new thing, hard but then you get used to it! 74 | 75 | --- 76 | 77 | # Regular blogging? 78 | 79 | No you don't have to unless you call your blog "the daily blog" or so. :wink: 80 | 81 | Only write if you enjoy it! Your blog can be a portfolio/news board only. 82 | 83 | --- 84 | 85 | # Tell me 86 | 87 | * Questions this afternoon :raising_hand: 88 | 89 | * Issues in the [website repo](https://github.com/maelle/rmd-blogging-course/issues) for questions :raising_hand: 90 | 91 | * [Tweets](https://twitter.com/ma_salmon)/emails to show me your websites. :star: 92 | -------------------------------------------------------------------------------- /config.toml: -------------------------------------------------------------------------------- 1 | baseURL = "https://scientific-rmd-blogging.netlify.app/" 2 | languageCode = "en-US" 3 | defaultContentLanguage = "en" 4 | title = "Scientific Rmd Blogging" 5 | enableEmoji = true 6 | pygmentsUseClasses=true 7 | ignoreFiles = ["\\.Rmd$", "\\.Rmarkdown$", "_files$", "_cache$", "index\\.html", '\.knit\.md$', '\.utf8\.md$'] 8 | 9 | [module] 10 | [[module.imports]] 11 | path = "github.com/matcornic/hugo-theme-learn" 12 | [[module.imports]] 13 | path = "github.com/dzello/reveal-hugo" 14 | 15 | [outputFormats.Reveal] 16 | baseName = "index" 17 | mediaType = "text/html" 18 | isHTML = true 19 | 20 | 21 | [outputs] 22 | home = [ "HTML", "RSS", "JSON"] 23 | 24 | [Languages] 25 | [Languages.en] 26 | title = "Scientific Rmd Blogging" 27 | weight = 1 28 | languageName = "English" 29 | 30 | [[Languages.en.menu.shortcuts]] 31 | name = " GitHub repo" 32 | identifier = "ds" 33 | url = "https://github.com/maelle/rmd-blogging-course" 34 | weight = 10 35 | 36 | [[Languages.en.menu.shortcuts]] 37 | name = " Snippets" 38 | url = "/snippets" 39 | weight = 20 40 | 41 | [[Languages.en.menu.shortcuts]] 42 | name = " Credits" 43 | url = "/credits" 44 | weight = 30 45 | 46 | [[Languages.en.menu.shortcuts]] 47 | name = " CC-BY Licence" 48 | url = "https://creativecommons.org/licenses/by/4.0/" 49 | weight = 40 50 | 51 | [params] 52 | editURL = "https://github.com/maelle/rmd-blogging-course/edit/main/content/" 53 | description = "Scientific Rmd Blogging" 54 | author = "Maëlle Salmon" 55 | showVisitedLinks = true 56 | disableBreadcrumb = false 57 | disableNextPrev = false 58 | themeVariant = "mine" 59 | 60 | 61 | 62 | [markup] 63 | [markup.goldmark] 64 | [markup.goldmark.renderer] 65 | unsafe = true 66 | 67 | [params.reveal_hugo] 68 | theme = "white" 69 | load_default_plugins = false 70 | plugins = [ 71 | "reveal-js/plugin/zoom-js/zoom.js", 72 | "reveal-js/plugin/notes/notes.js", 73 | ] 74 | -------------------------------------------------------------------------------- /layouts/partials/layout/theme.html: -------------------------------------------------------------------------------- 1 | 2 | {{- $reveal_location := $.Param "reveal_hugo.reveal_cdn" | default "reveal-js" -}} 3 | {{- $highlight_location := $.Param "reveal_hugo.highlight_cdn" | default "highlight-js" -}} 4 | {{- $custom_theme := $.Param "reveal_hugo.custom_theme" -}} 5 | 6 | 7 | {{- $custom_theme := $.Param "reveal_hugo.custom_theme" -}} 8 | {{- if $custom_theme -}} 9 | {{- $custom_theme_options := $.Param "reveal_hugo.custom_theme_options" | default dict -}} 10 | {{- if $.Param "reveal_hugo.custom_theme_compile" -}} 11 | {{ $asset := resources.Get $custom_theme | resources.ExecuteAsTemplate "_.scss" . | toCSS $custom_theme_options | minify | fingerprint }} 12 | 13 | {{- else -}} 14 | 15 | {{- end -}} 16 | {{ else -}} 17 | {{- $theme := $.Param "reveal_hugo.theme" | default "black" -}} 18 | 19 | {{ end -}} 20 | {{ if $.Param "reveal_hugo.load_default_plugins" | default true -}} 21 | 22 | {{- $highlight_theme := $.Param "reveal_hugo.highlight_theme" | default "default" -}} 23 | 24 | {{- end }} 25 | {{- $custom_css := $.Param "reveal_hugo.custom_css" -}} 26 | {{- if $custom_css -}} 27 | 28 | {{- end -}} 29 | 30 | {{ partial "highlight-style.html" . }} 31 | {{ with $.Params.countdown }} {{ end }} -------------------------------------------------------------------------------- /content/distill/demo/index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Notes from the demo 3 | menuTitle: Demo 4 | weight: 5 5 | slides: true 6 | output: hugodown::md_document 7 | rmd_hash: 56c6444412ac02ba 8 | 9 | --- 10 | 11 | - show the RStudio IDE, ask whether anyone is unfamiliar with it. 12 | 13 | - install the distill package, [`install.packages("distill")`](https://rdrr.io/r/utils/install.packages.html) 14 | 15 | - create blog (from RStudio Create New Project, not [`distill::create_blog()`](https://rdrr.io/pkg/distill/man/create_website.html)). 16 | 17 | - what's in the folder now? 18 | 19 | - show website in local browser. 20 | 21 | - [`usethis::use_git()`](https://usethis.r-lib.org/reference/use_git.html) 22 | 23 | - change site but not URL, and about. change citations: true!!! 24 | 25 | - rebuild the site via RStudio build button or [`rmarkdown::render_site()`](https://rdrr.io/pkg/rmarkdown/man/render_site.html). 26 | 27 | - show website in local browser. 28 | 29 | - edit and knit welcome. including author info!! 30 | 31 | - look what changed, commit 32 | 33 | - show website in local browser. 34 | 35 | - look at post html in \_posts and \_site. mention navbar 36 | 37 | - commit 38 | 39 | - add a post with [`distill::create_post()`](https://rdrr.io/pkg/distill/man/create_post.html). knit, look what changed this time. 40 | 41 | - add references 42 | 43 | - add latex, mention JavaScript 44 | 45 | - add footnote and aside 46 | 47 | - put website online via Netlify drag and drop. 48 | 49 | - add base\_url to site config, show citations metadata is added. 50 | 51 | - Netlify drag and drop. 52 | 53 | - Some minimal styling. Introduce the web developer console. 54 | 55 | - Netlify drag and drop 56 | 57 | - GitHub repo [`usethis::use_github()`](https://usethis.r-lib.org/reference/use_github.html) 58 | 59 | - mention git checkout -b and [the distill docs about blog post workflows](https://rstudio.github.io/distill/blog_workflow.html). 60 | 61 | - Other options for deployment (Netlify link to repo, [distill docs](https://rstudio.github.io/distill/publish_website.html)) 62 | 63 | - add Twitter&GitHub 64 | 65 | -------------------------------------------------------------------------------- /content/reproducibility/slides/index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | outputs: 3 | - Reveal 4 | title: Workflows 5 | hidden: true 6 | layout: list 7 | weight: 1 8 | output: hugodown::md_document 9 | rmd_hash: d72ca81ec9ad4774 10 | 11 | --- 12 | 13 | Reproducibility? 14 | ================ 15 | 16 | Should your blog posts still be "knittable?" 17 | 18 | ------------------------------------------------------------------------ 19 | 20 | Reproducibility? 21 | ================ 22 | 23 | - Be able to update your post short/medium term 24 | 25 | - Same for readers except for private data 26 | 27 | {{% fragment %}}
But blog posts will **age**, which is fine, a blog is not a current docs website. {{% /fragment %}} 28 | 29 | ------------------------------------------------------------------------ 30 | 31 | All posts 32 | ========= 33 | 34 | Need to re-knit posts for migration, tool updates? 35 | 36 | {{% fragment %}} Or use the R Markdown output after a point (.md), potentially with YAML/other tweaks. 37 | 38 | When I migrated from Jekyll to Hugo I used the .md, not .Rmd. {{% /fragment %}} 39 | 40 | ------------------------------------------------------------------------ 41 | 42 | Evergreen posts 43 | =============== 44 | 45 | If you want a tutorial to be evergreen you'll need to ensure it works with the latest packages etc. 46 | 47 | But are tutorials like package vignettes? 48 | 49 | ------------------------------------------------------------------------ 50 | 51 | Reproducible analyses 52 | ===================== 53 | 54 | How to archive your computing environment? 55 | 56 | It might be "easier" to archive the analysis elsewhere (tools for scientific articles) and link to that from the blog post. 57 | 58 | ------------------------------------------------------------------------ 59 | 60 | Transparency 61 | ============ 62 | 63 | For you, for readers. 64 | 65 | - Add session info to bottom of posts 66 | 67 | - Mention data origin (URL to data?) 68 | 69 | ------------------------------------------------------------------------ 70 | 71 | Common sense 72 | ============ 73 | 74 | - Backup 75 | 76 | - Make note of anything that might be tricky (dev version of a package) 77 | 78 | ------------------------------------------------------------------------ 79 | 80 | What's your own take? 81 | ===================== 82 | 83 | -------------------------------------------------------------------------------- /content/promotion/slides/index.en.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | outputs: 3 | - Reveal 4 | title: Readers 5 | hidden: true 6 | layout: list 7 | weight: 1 8 | output: hugodown::md_document 9 | --- 10 | 11 | # Promote your blog 12 | 13 | --- 14 | 15 | # Put its URL everywhere! 16 | 17 | Your ORCID profile, Twitter profile, GitHub profile, etc. 18 | 19 | No dead ends please! 20 | 21 | --- 22 | 23 | # R Weekly 24 | 25 | Weekly newsletter featuring links to blog posts but also slidedecks, etc., about R. 26 | 27 | * One-off sharing: [web form](https://rweekly.org/submit), [PRs](https://github.com/rweekly/rweekly.org). 28 | 29 | * Add your RSS feed via the [web form](https://rweekly.org/submit). 30 | 31 | --- 32 | 33 | # R Bloggers 34 | 35 | Ingests the entire feed and repost posts. 36 | 37 | It can take time from [feed submission](https://www.r-bloggers.com/add-your-blog/) to feed validation. 38 | 39 | --- 40 | 41 | # Social media 42 | 43 | E.g. Twitter. 44 | 45 | Write a clear text, post URL, add a few hashtags, image (or carefully crafted infographics?) + alternative text. 46 | 47 | --- 48 | 49 | # SEO 50 | 51 | Search Engine Optimization 52 | 53 | * Add links to your post 54 | 55 | * Read resources by marketers 56 | 57 | --- 58 | 59 | # Interact with readers 60 | 61 | --- 62 | 63 | # How to interact with readers? 64 | 65 | On social media? 66 | 67 | In comments? For Hugo, [Utteranc.es as an alternative to Disqus](https://masalmon.eu/2019/10/02/disqus/). 68 | 69 | --- 70 | 71 | # Negative feedback 72 | 73 | (not constructive feedback) 74 | 75 | Have a support system. 76 | 77 | You don't have to respond publicly, or at all. 78 | 79 | If _you_ were wrong, listen and do better. 80 | 81 | --- 82 | 83 | # Encouraging citations 84 | 85 | --- 86 | 87 | # Citing your posts 88 | 89 | * Distill metadata 90 | 91 | * Hugo [custom layout](https://github.com/statnmap/hugo-statnmap-theme/blob/3e2a54a9836fdd65779865e91058ba304b628336/layouts/partials/citation.html) 92 | 93 | * [DOI](https://twitter.com/mfenner/status/1126523120591020032)? 94 | 95 | --- 96 | 97 | # Analytics 98 | 99 | --- 100 | 101 | # Analytics 102 | 103 | * Do you need numbers? E.g. if you blog at work. 104 | 105 | * Are you ok using Google Analytics? 106 | 107 | * GDPR :wink: 108 | 109 | * Alternatives? [Fathom](https://usefathom.com/)? Others? -------------------------------------------------------------------------------- /content/hugo/demo/index.en.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: Notes from the demo 3 | menuTitle: Demo 4 | weight: 5 5 | slides: true 6 | output: hugodown::md_document 7 | --- 8 | 9 | - install the remotes package, `install.packages("remotes)` 10 | 11 | - install the hugodown package, `remotes::install_github("r-lib/hugodown")` 12 | 13 | - `hugodown::hugo_install()` 14 | 15 | - new RStudio empty project. 16 | 17 | - `hugo new site . --force` from the command line in that new folder. 18 | 19 | - Download https://github.com/yihui/hugo-xmin and put into themes, remove "-master" from the folder name, delete example site. 20 | 21 | - Copy paste https://github.com/yihui/hugo-xmin/blob/master/exampleSite/config.toml 22 | 23 | - Create `_hugodown.yaml` with `hugo_version: 0.73.0` 24 | 25 | - `hugodown::hugo_start()` 26 | 27 | - add about.md 28 | 29 | - copy-paste from [hugodown setup vignette](https://hugodown.r-lib.org/articles/config.html) 30 | 31 | - create [static/css/code.css](/snippets/#codecss) from and create [layouts/partial/head_custom.html](/snippets/#head_customhtml) (one should read [theme docs](https://xmin.yihui.org/about/)!) 32 | 33 | - for mathjax create [layouts/partial/foot_custom.html](/snippets/#head_customhtml) 34 | 35 | - create post in content/post/2020-06-25-cool/index.Rmd and copy-paste from snippets page. knit, preview. 36 | 37 | - add citations. 38 | 39 | - `hugodown::hugo_stop()`, `hugodown::hugo_start(render_to_disk = TRUE)` 40 | 41 | - Netlify drag and drop 42 | 43 | - add URL to config 44 | 45 | - then something easier from the code point of view but more overwhelming! 46 | 47 | - create empty RStudio project (with git if it's available) 48 | 49 | - `hugodown::hugo_install('0.66.0')` 50 | 51 | - `hugodown::create_site_academic()`. Be happy to see everything happening automatically :sparkles: 52 | 53 | - `hugodown::hugo_start(render_to_disk = TRUE)`, open localhost in the browser. 54 | 55 | - Change site title and [theme](https://sourcethemes.com/academic/themes/) in config/_default/params.toml. Yes a theme for a theme! 56 | 57 | - Mention [academic docs](https://sourcethemes.com/academic/), all the things one can change. 58 | 59 | - `hugodown::use_post("post/new-rmd-post")`, knit, see post. 60 | 61 | - say there will probably be other themes later. show [Hugo theme gallery](https://themes.gohugo.io/) and how I would choose themes. 62 | 63 | - `usethis::use_github()`, `hugodown::use_netlify_toml()`, go to Netlify interface. 64 | 65 | - add URL to config 66 | -------------------------------------------------------------------------------- /content/conclusion/slides/index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | outputs: 3 | - Reveal 4 | title: Conclusion 5 | hidden: true 6 | layout: list 7 | weight: 1 8 | output: hugodown::md_document 9 | rmd_hash: b777bbe39c9e64c8 10 | 11 | --- 12 | 13 | Scientific blogging with R Markdown 14 | =================================== 15 | 16 | :sob: Nearly time to say goodbye! 17 | 18 | ------------------------------------------------------------------------ 19 | 20 | - distill: perfect, not flexible 21 | 22 | - Hugo&hugodown: very flexible (too flexible?), changes fast, experimental R package 23 | 24 | - WordPress&goodpress: also flexible, even more experimental R package 25 | 26 | ------------------------------------------------------------------------ 27 | 28 | What to choose 29 | ============== 30 | 31 | - distill 32 | 33 | - Hugo Academic with [`hugodown::create_site_academic()`](https://rdrr.io/pkg/hugodown/man/create_site_academic.html) 34 | 35 | - WordPress if you already use WordPress? 36 | 37 | ------------------------------------------------------------------------ 38 | 39 | What to choose 40 | ============== 41 | 42 | Start by playing! Don't commit right away. 43 | 44 | Does any of you want to say what they'd choose and why? 45 | 46 | ------------------------------------------------------------------------ 47 | 48 | True for all 49 | ============ 50 | 51 | - Read the docs and follow development! :eyes: 52 | 53 | - Backup! :warning: 54 | 55 | ------------------------------------------------------------------------ 56 | 57 | Change your mind? 58 | ================= 59 | 60 | - Migration tools 61 | 62 | - `yaml`, `commonmark` packages, etc. 63 | 64 | - Redirects! URLs are important. 404 page. 65 | 66 | ------------------------------------------------------------------------ 67 | 68 | Have fun! 69 | ========= 70 | 71 | If you're worried about blogging, find a blogging buddy to read your drafts? 72 | 73 | Make efforts but don't be perfectionist. 74 | 75 | ------------------------------------------------------------------------ 76 | 77 | Setup is not fun 78 | ================ 79 | 80 | - With R helper packages, setup is smoother 81 | 82 | - But in general setup = learning a new thing, hard but then you get used to it! 83 | 84 | ------------------------------------------------------------------------ 85 | 86 | Regular blogging? 87 | ================= 88 | 89 | No you don't have to unless you call your blog "the daily blog" or so. :wink: 90 | 91 | Only write if you enjoy it! Your blog can be a portfolio/news board only. 92 | 93 | ------------------------------------------------------------------------ 94 | 95 | Tell me 96 | ======= 97 | 98 | - Questions this afternoon :raising_hand: 99 | 100 | - Issues in the [website repo](https://github.com/maelle/rmd-blogging-course/issues) for questions :raising_hand: 101 | 102 | - [Tweets](https://twitter.com/ma_salmon)/emails to show me your websites. :star: 103 | 104 | -------------------------------------------------------------------------------- /content/distill/slides/index.en.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | outputs: 3 | - Reveal 4 | title: distill 5 | hidden: true 6 | layout: list 7 | weight: 1 8 | output: hugodown::md_document 9 | countdown: true 10 | --- 11 | 12 | # Distill 13 | 14 | --- 15 | 16 | [Distill](rstudio.github.io/distill/) is both a framework and an R package. 17 | 18 | > Distill for R Markdown is a web publishing format optimized for scientific and technical communication. 19 | 20 | --- 21 | 22 | * Output format for single documents 23 | 24 | * Websites 25 | 26 | * Blogs, like websites but with blog posts than aren't re-rendered automatically. 27 | 28 | --- 29 | 30 | Helpers like `distill::create_post()` 31 | 32 | --- 33 | 34 | # From Rmd to website 35 | 36 | Under the hood 37 | 38 | 39 | ```{=html} 40 | {{}} 41 | graph LR; 42 | A[Rmd] -->|"R ( distill :package:) & Pandoc & Distill framework" | B[HTML] 43 | {{< /mermaid >}} 44 | ``` 45 | 46 | Inspired by [Emi Tanaka's post](https://emitanaka.org/r/posts/2018-12-12-scientific-and-technical-blogging-radix-vs-blogdown/) 47 | 48 | --- 49 | 50 | # From Rmd to website 51 | 52 | What you do 53 | 54 | 55 | ```{=html} 56 | {{}} 57 | graph LR; 58 | A[Rmd] -->|" :large_blue_circle: knit button" | B[HTML] 59 | {{< /mermaid >}} 60 | ``` 61 | 62 | 63 | --- 64 | 65 | :train: Time for a demo! 66 | 67 | [Notes on the course website](/distill/demo/) 68 | 69 | --- 70 | 71 | Scientific Rmd Blog Checklist 72 | 73 | * [x] R Markdown 74 | * [x] Syntax highlighting (for all knitr-supported languages) 75 | * [x] Modern 76 | * [x] .bib 77 | * [x] Citation for posts 78 | * [x] Equations 79 | 80 | --- 81 | 82 | # Sustainability 83 | 84 | Created by: 85 | 86 | ```{r, echo=FALSE, results="asis"} 87 | glue::glue_collapse( 88 | trimws( 89 | gsub("<.*>", "", 90 | desc::desc_get_author(file = find.package("distill"), role = "aut") 91 | ) 92 | ), 93 | sep = ", ") 94 | ``` 95 | 96 | Used for [RStudio AI blog](https://blogs.rstudio.com/ai/), in particular. 97 | 98 | Active development. 99 | 100 | --- 101 | 102 | # Limitations? 103 | 104 | * Content stored as html (harder to migrate?) 105 | 106 | * Limited possibilities for customization (blessing in disguise?) 107 | 108 | * Some open issues (ORCID support, RSS feed tweaking) but active development 109 | 110 | --- 111 | 112 | # Further resources 113 | 114 | [Listed on the course website](/distill/further-resources/) :books: 115 | 116 | --- 117 | 118 | # Questions, comments? 119 | 120 | Write them in the pad! 121 | 122 | --- 123 | 124 | # Time for a break :coffee: 125 | 126 | 127 | 128 |
129 | 130 | 05:00 131 | 132 |
133 | 134 | -------------------------------------------------------------------------------- /content/distill/further-resources.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: More about distill 3 | menuTitle: Further resources 4 | weight: 50 5 | --- 6 | 7 | ## Read the manual :wink: 8 | 9 | There aren't many pages in [distill docs website](https://rstudio.github.io/distill/) so I'd recommend reading all of them if you commit to this website builder. 10 | 11 | ## Follow developments? :eyes: 12 | 13 | If you start using distill for your website... 14 | 15 | * Read the changelog when updating the package? 16 | 17 | * [Watch development on GitHub](https://help.github.com/en/github/managing-subscriptions-and-notifications-on-github/viewing-your-subscriptions#configuring-your-watch-settings-for-an-individual-repository)? 18 | 19 | * Subscribe to the [issues](https://github.com/rstudio/distill/issues) that are interesting to you: [search](https://github.com/rstudio/distill/issues/9), [ORCID](https://github.com/rstudio/distill/issues/21), etc.? 20 | 21 | ## Websites for inspiration :sparkles: 22 | 23 | | Website | Source | 24 | |---|---| 25 | |[Scholarly Communication Analytics](https://subugoe.github.io/scholcomm_analytics/)| [](https://github.com/subugoe/scholcomm_analytics) | 26 | | [RStudio AI Blog](https://blogs.rstudio.com/ai/) | [](https://github.com/rstudio/ai-blog) | 27 | | [The Mockup Blog by Tom Mock](https://themockup.blog/) | [](https://github.com/jthomasmock/radix_themockup) | 28 | | [Michael Clark's personal website](https://m-clark.github.io/) | [](https://github.com/m-clark/m-clark.github.io) | 29 | | [Antoine Bichat's personal website](https://abichat.github.io/) | [](https://github.com/abichat/abichat.github.io) | 30 | 31 | 32 | ### A few more links 33 | 34 | [Emi Tanaka's take on distill (back when the package was called radix) vs Hugo (with blogdown)](https://emitanaka.org/r/posts/2018-12-12-scientific-and-technical-blogging-radix-vs-blogdown/) 35 | 36 | [A tentative GitHub code search](https://github.com/search?l=&o=desc&q=distill%3A%3Adistill_website+filename%3Aindex.Rmd&s=indexed&type=Code). 37 | 38 | ## A warning about customization :warning: 39 | 40 | > A word of warning though: Distill (the original library upon which the R package is based) is strongly opinionated about CSS and sometimes it's tricky or impossible to change things. Just to say your mileage may vary and if there is something you can't quite get right there is not likely much we can do about it -- *JJ Allaire [in a GitHub issue](https://github.com/rstudio/distill/issues/100#issuecomment-508075573)*. 41 | 42 | {{% notice tip %}} 43 | If you liked distill's looks but would like further customization, and if you like Hugo that we'll present in the next section, check out [this Distill theme for Hugo](https://github.com/activatedgeek/distillpub). 44 | {{% /notice %}} 45 | 46 | ## Where to get help? :wave: 47 | 48 | * [RStudio community forum](https://community.rstudio.com/c/R-Markdown/10) (RMarkdown category, distill tag) 49 | 50 | * [distill issue tracker](https://github.com/rstudio/distill/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) -------------------------------------------------------------------------------- /content/hugo/demo/index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Notes from the demo 3 | menuTitle: Demo 4 | weight: 5 5 | slides: true 6 | output: hugodown::md_document 7 | rmd_hash: bd629f4e40ea7fcd 8 | 9 | --- 10 | 11 | - install the remotes package, `install.packages("remotes)` 12 | 13 | - install the hugodown package, [`remotes::install_github("r-lib/hugodown")`](https://remotes.r-lib.org/reference/install_github.html) 14 | 15 | - [`hugodown::hugo_install()`](https://rdrr.io/pkg/hugodown/man/hugo_install.html) 16 | 17 | - new RStudio empty project. 18 | 19 | - `hugo new site . --force` from the command line in that new folder. 20 | 21 | - Download https://github.com/yihui/hugo-xmin and put into themes, remove "-master" from the folder name, delete example site. 22 | 23 | - Copy paste https://github.com/yihui/hugo-xmin/blob/master/exampleSite/config.toml 24 | 25 | - Create `_hugodown.yaml` with `hugo_version: 0.73.0` 26 | 27 | - [`hugodown::hugo_start()`](https://rdrr.io/pkg/hugodown/man/hugo_start.html) 28 | 29 | - add about.md 30 | 31 | - copy-paste from [hugodown setup vignette](https://hugodown.r-lib.org/articles/config.html) 32 | 33 | - create [static/css/code.css](/snippets/#codecss) from and create [layouts/partial/head\_custom.html](/snippets/#head_customhtml) (one should read [theme docs](https://xmin.yihui.org/about/)!) 34 | 35 | - for mathjax create [layouts/partial/foot\_custom.html](/snippets/#head_customhtml) 36 | 37 | - create post in content/post/2020-06-25-cool/index.Rmd and copy-paste from snippets page. knit, preview. 38 | 39 | - add citations. 40 | 41 | - [`hugodown::hugo_stop()`](https://rdrr.io/pkg/hugodown/man/hugo_start.html), [`hugodown::hugo_start(render_to_disk = TRUE)`](https://rdrr.io/pkg/hugodown/man/hugo_start.html) 42 | 43 | - Netlify drag and drop 44 | 45 | - add URL to config 46 | 47 | - then something easier from the code point of view but more overwhelming! 48 | 49 | - create empty RStudio project (with git if it's available) 50 | 51 | - [`hugodown::hugo_install('0.66.0')`](https://rdrr.io/pkg/hugodown/man/hugo_install.html) 52 | 53 | - [`hugodown::create_site_academic()`](https://rdrr.io/pkg/hugodown/man/create_site_academic.html). Be happy to see everything happening automatically :sparkles: 54 | 55 | - [`hugodown::hugo_start(render_to_disk = TRUE)`](https://rdrr.io/pkg/hugodown/man/hugo_start.html), open localhost in the browser. 56 | 57 | - Change site title and [theme](https://sourcethemes.com/academic/themes/) in config/\_default/params.toml. Yes a theme for a theme! 58 | 59 | - Mention [academic docs](https://sourcethemes.com/academic/), all the things one can change. 60 | 61 | - [`hugodown::use_post("post/new-rmd-post")`](https://rdrr.io/pkg/hugodown/man/use_post.html), knit, see post. 62 | 63 | - say there will probably be other themes later. show [Hugo theme gallery](https://themes.gohugo.io/) and how I would choose themes. 64 | 65 | - [`usethis::use_github()`](https://usethis.r-lib.org/reference/use_github.html), [`hugodown::use_netlify_toml()`](https://rdrr.io/pkg/hugodown/man/use_netlify_toml.html), go to Netlify interface. 66 | 67 | - add URL to config 68 | 69 | -------------------------------------------------------------------------------- /content/promotion/slides/index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | outputs: 3 | - Reveal 4 | title: Readers 5 | hidden: true 6 | layout: list 7 | weight: 1 8 | output: hugodown::md_document 9 | rmd_hash: 215653ad9f567b4b 10 | 11 | --- 12 | 13 | Promote your blog 14 | ================= 15 | 16 | ------------------------------------------------------------------------ 17 | 18 | Put its URL everywhere! 19 | ======================= 20 | 21 | Your ORCID profile, Twitter profile, GitHub profile, etc. 22 | 23 | No dead ends please! 24 | 25 | ------------------------------------------------------------------------ 26 | 27 | R Weekly 28 | ======== 29 | 30 | Weekly newsletter featuring links to blog posts but also slidedecks, etc., about R. 31 | 32 | - One-off sharing: [web form](https://rweekly.org/submit), [PRs](https://github.com/rweekly/rweekly.org). 33 | 34 | - Add your RSS feed via the [web form](https://rweekly.org/submit). 35 | 36 | ------------------------------------------------------------------------ 37 | 38 | R Bloggers 39 | ========== 40 | 41 | Ingests the entire feed and repost posts. 42 | 43 | It can take time from [feed submission](https://www.r-bloggers.com/add-your-blog/) to feed validation. 44 | 45 | ------------------------------------------------------------------------ 46 | 47 | Social media 48 | ============ 49 | 50 | E.g. Twitter. 51 | 52 | Write a clear text, post URL, add a few hashtags, image (or carefully crafted infographics?) + alternative text. 53 | 54 | ------------------------------------------------------------------------ 55 | 56 | SEO 57 | === 58 | 59 | Search Engine Optimization 60 | 61 | - Add links to your post 62 | 63 | - Read resources by marketers 64 | 65 | ------------------------------------------------------------------------ 66 | 67 | Interact with readers 68 | ===================== 69 | 70 | ------------------------------------------------------------------------ 71 | 72 | How to interact with readers? 73 | ============================= 74 | 75 | On social media? 76 | 77 | In comments? For Hugo, [Utteranc.es as an alternative to Disqus](https://masalmon.eu/2019/10/02/disqus/). 78 | 79 | ------------------------------------------------------------------------ 80 | 81 | Negative feedback 82 | ================= 83 | 84 | (not constructive feedback) 85 | 86 | Have a support system. 87 | 88 | You don't have to respond publicly, or at all. 89 | 90 | If *you* were wrong, listen and do better. 91 | 92 | ------------------------------------------------------------------------ 93 | 94 | Encouraging citations 95 | ===================== 96 | 97 | ------------------------------------------------------------------------ 98 | 99 | Citing your posts 100 | ================= 101 | 102 | - Distill metadata 103 | 104 | - Hugo [custom layout](https://github.com/statnmap/hugo-statnmap-theme/blob/3e2a54a9836fdd65779865e91058ba304b628336/layouts/partials/citation.html) 105 | 106 | - [DOI](https://twitter.com/mfenner/status/1126523120591020032)? 107 | 108 | ------------------------------------------------------------------------ 109 | 110 | Analytics 111 | ========= 112 | 113 | ------------------------------------------------------------------------ 114 | 115 | Analytics 116 | ========= 117 | 118 | - Do you need numbers? E.g. if you blog at work. 119 | 120 | - Are you ok using Google Analytics? 121 | 122 | - GDPR :wink: 123 | 124 | - Alternatives? [Fathom](https://usefathom.com/)? Others? 125 | 126 | -------------------------------------------------------------------------------- /content/intro/slides/index.en.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | outputs: 3 | - Reveal 4 | title: Scientific R Markdown blog? 5 | hidden: true 6 | layout: list 7 | weight: 1 8 | output: hugodown::md_document 9 | --- 10 | 11 | # Scientific blogging with R Markdown 12 | 13 | :wave: Welcome! 14 | 15 | --- 16 | 17 | I'm Maëlle, I like R, blogging and science. 18 | 19 | {{% fragment %}} 20 | 21 | :house: https://masalmon.eu 22 | 23 | {{% /fragment %}} 24 | 25 | 26 | --- 27 | 28 | # Why blog? 29 | 30 | --- 31 | 32 | * Notes for future you 33 | 34 | * Passion for sharing? 35 | 36 | * Opportunities 37 | 38 | --- 39 | 40 | Teaching this course is an opportunity I got from blogging but blogging is not a pyramid scheme :wink: 41 | 42 | --- 43 | 44 | # Why create blog? 45 | 46 | What if I don't really want to blog regularly? 47 | 48 | 49 | 50 | - {{% fragment %}}Have a platform to share stuff when you need to.{{% /fragment %}} 51 | - {{% fragment %}}Portfolio. In particular, imagine someone recommending you for a thing.{{% /fragment %}} 52 | 53 | 54 | --- 55 | 56 | # What is a website? 57 | 58 | * static: HTML, CSS, JS 59 | 60 | * non static: more machinery on the server side 61 | 62 | Online server somewhere. 63 | 64 | --- 65 | 66 | # Why Rmd for blogging? 67 | 68 | - {{% fragment %}}Data analysis with R{{% /fragment %}} 69 | - {{% fragment %}}Blogging about R{{% /fragment %}} 70 | - {{% fragment %}}R as an utility tool e.g. to generate text from structured data{{% /fragment %}} 71 | - {{% fragment %}}knitr supports other languages...{{% /fragment %}} 72 | 73 | --- 74 | 75 | # WHAT is a scientific Rmd blog? 76 | 77 | --- 78 | 79 | IMHO :smile_cat: 80 | 81 | I'll list criteria so we have something to compare our adventures to. 82 | 83 | --- 84 | 85 | # Tech part 86 | 87 | 88 | 89 | * {{% fragment %}}Easy way to update from Rmd without too much copy-pasting{{% /fragment %}} 90 | 91 | * {{% fragment %}}Fits into your existing workflow or uses things you want to learn and invest time in{{% /fragment %}} 92 | 93 | * {{% fragment %}}Code, syntax highlighting{{% /fragment %}} 94 | 95 | * {{% fragment %}}Modern tooling (html5? mobile friendly?){{% /fragment %}} 96 | 97 | 98 | --- 99 | 100 | # Science part 101 | 102 | * {{% fragment %}}References from a .bib file{{% /fragment %}} 103 | 104 | * {{% fragment %}}Easy way to cite posts?{{% /fragment %}} 105 | 106 | * {{% fragment %}}Equations {{% /fragment %}} 107 | 108 | * {{% fragment %}}Content. Blog about science, or stuff relevant to science&co (e.g. comparisons of way to fit and present linear models in R).{{% /fragment %}} 109 | 110 | --- 111 | 112 | # Human part 113 | 114 | * {{% fragment %}}Accessible. Alt text, contrast. Don't add gate-keeping to science.{{% /fragment %}} 115 | 116 | * {{% fragment %}}You OWN it. Content, URL (no commercial service, no employer).{{% /fragment %}} 117 | 118 | * {{% fragment %}}Allows for interactions (social media? commenting?){{% /fragment %}} 119 | 120 | * {{% fragment %}}Costs a few dollars a month at most.{{% /fragment %}} 121 | 122 | --- 123 | 124 | # Let's go 125 | 126 | * {{% fragment %}}distill{{% /fragment %}} 127 | 128 | * {{% fragment %}}Hugo&hugodown{{% /fragment %}} 129 | 130 | * {{% fragment %}}WordPress{{% /fragment %}} 131 | 132 | * {{% fragment %}}Reproducibility{{% /fragment %}} 133 | 134 | * {{% fragment %}}Promotion{{% /fragment %}} 135 | 136 | * {{% fragment %}}Debrief{{% /fragment %}} 137 | 138 | --- 139 | 140 | # We'll start with a tour of the course website 141 | 142 | https://tiny.cc/rmd-blog 143 | -------------------------------------------------------------------------------- /content/hugo/slides/index.en.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | outputs: 3 | - Reveal 4 | title: Hugo & hugodown 5 | hidden: true 6 | layout: list 7 | weight: 1 8 | output: hugodown::md_document 9 | countdown: true 10 | --- 11 | 12 | # Hugo and hugodown 13 | 14 | A powerful static generator, a handy WIP package 15 | 16 | --- 17 | 18 | # [Hugo](https://gohugo.io/) 19 | 20 | Powerful and fast static generator 21 | 22 | Only an .exe to install :tada: 23 | 24 | --- 25 | 26 | # [hugodown](https://hugodown.r-lib.org/) 27 | 28 | [R :package:](https://hugodown.r-lib.org/) 29 | 30 | * An R Markdown output format 31 | 32 | * Handy helpers 33 | 34 | Experimental but the best bet in my opinion. 35 | 36 | --- 37 | 38 | # From Rmd to website 39 | 40 | Under the hood 41 | 42 | ```{=html} 43 | {{}} 44 | graph LR; 45 | A[Rmd] --> |"R ( hugodown :package:,
downlit :package:)
& Pandoc"| B{md} 46 | B --> |"Hugo (Goldmark, Chroma)"| C[HTML] 47 | {{< /mermaid >}} 48 | ``` 49 | 50 | Inspired by [Emi Tanaka's post](https://emitanaka.org/r/posts/2018-12-12-scientific-and-technical-blogging-radix-vs-blogdown/) 51 | 52 | --- 53 | 54 | # From Rmd to website 55 | 56 | What you do 57 | 58 | ```{=html} 59 | {{}} 60 | graph LR; 61 | A[Rmd] --> |":large_blue_circle: knit button"| B{md} 62 | B --> |"hugo build (locally or cloud)"| C[HTML] 63 | {{< /mermaid >}} 64 | ``` 65 | 66 | --- 67 | 68 | No syntax highlighting :expressionless: 69 | 70 | ```{=html} 71 |
ggplot2::ggplot()
 72 | 
73 | ``` 74 | 75 | Chroma syntax highlighting :+1: 76 | 77 | ````{=html} 78 | ```r 79 | ggplot2::ggplot() 80 | ``` 81 | ```` 82 | 83 | downlit syntax highlighting :smiley: 84 | 85 | ```{r, eval = FALSE} 86 | ggplot2::ggplot() 87 | ``` 88 | 89 | --- 90 | 91 | ```{=html} 92 | {{< figure src="/images/highlight.jpg" alt="A meme to explain why downlit is great" height="550" >}} 93 | ``` 94 | 95 | Inspired by [Mara Averick](https://twitter.com/dataandme/status/1255510799273132032) 96 | 97 | --- 98 | 99 | # hugodown syntax highlighting 100 | 101 | * downlit for R :tada: 102 | 103 | * Chroma for other languages :sparkles: 104 | 105 | 106 | --- 107 | 108 | :mountain_cableway: Time for a demo! 109 | 110 | [Notes on the course website](/hugo/demo/) 111 | 112 | --- 113 | 114 | Scientific Rmd Blog Checklist 115 | 116 | * [x] R Markdown 117 | * [x] Syntax highlighting 118 | * [x] Modern 119 | * [x] .bib 120 | * [?] Citation for posts (possible but custom layout) 121 | * [x] Equations 122 | 123 | --- 124 | 125 | # Sustainability 126 | 127 | Created by: 128 | 129 | ```{r, echo=FALSE, results="asis"} 130 | glue::glue_collapse( 131 | trimws( 132 | gsub("<.*>", "", 133 | desc::desc_get_author(file = find.package("hugodown"), role = "aut") 134 | ) 135 | ), 136 | sep = ", ") 137 | ``` 138 | 139 | Used for [tidyverse.org](https://tidyverse.org), in particular. 140 | 141 | [Active development](https://github.com/r-lib/hugodown/). 142 | 143 | --- 144 | 145 | # Limitations? 146 | 147 | * hugodown is a WIP package. One easy to use theme only at the moment, but a great one! 148 | 149 | * Hugo changes a lot (but hugodown helps protect your projects from that) 150 | 151 | --- 152 | 153 | # Further resources 154 | 155 | [Listed on the course website](/hugo/further-resources/) :ledger: 156 | 157 | --- 158 | 159 | # Questions, comments? 160 | 161 | Write them in the pad! 162 | 163 | --- 164 | 165 | # Time for a break :tea: 166 | 167 | 168 | 169 |
170 | 171 | 05:00 172 | 173 |
174 | 175 | -------------------------------------------------------------------------------- /content/distill/slides/index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | outputs: 3 | - Reveal 4 | title: distill 5 | hidden: true 6 | layout: list 7 | weight: 1 8 | output: hugodown::md_document 9 | countdown: true 10 | rmd_hash: f958a4a6947e9d10 11 | 12 | --- 13 | 14 | Distill 15 | ======= 16 | 17 | ------------------------------------------------------------------------ 18 | 19 | [Distill](rstudio.github.io/distill/) is both a framework and an R package. 20 | 21 | > Distill for R Markdown is a web publishing format optimized for scientific and technical communication. 22 | 23 | ------------------------------------------------------------------------ 24 | 25 | - Output format for single documents 26 | 27 | - Websites 28 | 29 | - Blogs, like websites but with blog posts than aren't re-rendered automatically. 30 | 31 | ------------------------------------------------------------------------ 32 | 33 | Helpers like [`distill::create_post()`](https://rdrr.io/pkg/distill/man/create_post.html) 34 | 35 | ------------------------------------------------------------------------ 36 | 37 | From Rmd to website 38 | =================== 39 | 40 | Under the hood 41 | 42 | {{}} 43 | graph LR; 44 | A[Rmd] -->|"R ( distill :package:) & Pandoc & Distill framework" | B[HTML] 45 | {{< /mermaid >}} 46 | 47 | Inspired by [Emi Tanaka's post](https://emitanaka.org/r/posts/2018-12-12-scientific-and-technical-blogging-radix-vs-blogdown/) 48 | 49 | ------------------------------------------------------------------------ 50 | 51 | From Rmd to website 52 | =================== 53 | 54 | What you do 55 | 56 | {{}} 57 | graph LR; 58 | A[Rmd] -->|" :large_blue_circle: knit button" | B[HTML] 59 | {{< /mermaid >}} 60 | 61 | ------------------------------------------------------------------------ 62 | 63 | :train: Time for a demo! 64 | 65 | [Notes on the course website](/distill/demo/) 66 | 67 | ------------------------------------------------------------------------ 68 | 69 | Scientific Rmd Blog Checklist 70 | 71 | - [x] R Markdown 72 | - [x] Syntax highlighting (for all knitr-supported languages) 73 | - [x] Modern 74 | - [x] .bib 75 | - [x] Citation for posts 76 | - [x] Equations 77 | 78 | ------------------------------------------------------------------------ 79 | 80 | Sustainability 81 | ============== 82 | 83 | Created by: 84 | 85 |
86 | 87 | JJ Allaire \[aut, cre\], Rich Iannone \[aut\], Yihui Xie \[aut\] 88 | 89 |
90 | 91 | Used for [RStudio AI blog](https://blogs.rstudio.com/ai/), in particular. 92 | 93 | Active development. 94 | 95 | ------------------------------------------------------------------------ 96 | 97 | Limitations? 98 | ============ 99 | 100 | - Content stored as html (harder to migrate?) 101 | 102 | - Limited possibilities for customization (blessing in disguise?) 103 | 104 | - Some open issues (ORCID support, RSS feed tweaking) but active development 105 | 106 | ------------------------------------------------------------------------ 107 | 108 | Further resources 109 | ================= 110 | 111 | [Listed on the course website](/distill/further-resources/) :books: 112 | 113 | ------------------------------------------------------------------------ 114 | 115 | Questions, comments? 116 | ==================== 117 | 118 | Write them in the pad! 119 | 120 | ------------------------------------------------------------------------ 121 | 122 | Time for a break :coffee: 123 | ========================= 124 | 125 | 126 | 127 |
128 | 129 | 05:00 130 | 131 |
132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /layouts/partials/layout/javascript.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{- $reveal_location := $.Param "reveal_hugo.reveal_cdn" | default "reveal-js" -}} 6 | 7 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 47 | 48 | {{ if $.Param "reveal_hugo.load_default_plugins" | default true }} 49 | {{ $default_plugins := slice "plugin/markdown/marked.js" "plugin/markdown/markdown.js" "plugin/highlight/highlight.js" "plugin/zoom-js/zoom.js" }} 50 | {{ range $default_plugins }} 51 | 52 | {{ end }} 53 | 54 | 55 | {{ end }} 56 | 57 | {{ range $.Param "reveal_hugo.plugins" }} 58 | 59 | {{ end }} 60 | {{- $custom_js := $.Param "reveal_hugo.custom_js" -}} 61 | {{- if $custom_js -}} 62 | 63 | {{- end -}} 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /static/css/theme-mine.css: -------------------------------------------------------------------------------- 1 | 2 | :root{ 3 | 4 | --MAIN-TEXT-color:#333e50; /* Color of text by default */ 5 | --MAIN-TITLES-TEXT-color: #5e5e5e; /* Color of titles h2-h3-h4-h5 */ 6 | --MAIN-LINK-color:#1C90F3; /* Color of links */ 7 | --MAIN-LINK-HOVER-color:#167ad0; /* Color of hovered links */ 8 | --MAIN-ANCHOR-color: #1C90F3; /* color of anchors on titles */ 9 | 10 | --MENU-HEADER-BG-color:#FA8072; /* Background color of menu header */ 11 | --MENU-HEADER-BORDER-color:#33a1ff; /*Color of menu header border */ 12 | 13 | --MENU-SEARCH-BG-color:#fff; /* Search field background color (by default borders + icons) */ 14 | --MENU-SEARCH-BOX-color: #33a1ff; /* Override search field border color */ 15 | --MENU-SEARCH-BOX-ICONS-color: #a1d2fd; /* Override search field icons color */ 16 | 17 | --MENU-SECTIONS-ACTIVE-BG-color:#20272b; /* Background color of the active section and its childs */ 18 | --MENU-SECTIONS-BG-color:#252c31; /* Background color of other sections */ 19 | --MENU-SECTIONS-LINK-color: #ccc; /* Color of links in menu */ 20 | --MENU-SECTIONS-LINK-HOVER-color: #e6e6e6; /* Color of links in menu, when hovered */ 21 | --MENU-SECTION-ACTIVE-CATEGORY-color: #777; /* Color of active category text */ 22 | --MENU-SECTION-ACTIVE-CATEGORY-BG-color: #fff; /* Color of background for the active category (only) */ 23 | 24 | --MENU-VISITED-color: #33a1ff; /* Color of 'page visited' icons in menu */ 25 | --MENU-SECTION-HR-color: #20272b; /* Color of
separator in menu */ 26 | 27 | } 28 | 29 | body { 30 | color: var(--MAIN-TEXT-color) !important; 31 | } 32 | 33 | textarea:focus, input[type="email"]:focus, input[type="number"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type="tel"]:focus, input[type="text"]:focus, input[type="url"]:focus, input[type="color"]:focus, input[type="date"]:focus, input[type="datetime"]:focus, input[type="datetime-local"]:focus, input[type="month"]:focus, input[type="time"]:focus, input[type="week"]:focus, select[multiple=multiple]:focus { 34 | border-color: none; 35 | box-shadow: none; 36 | } 37 | 38 | h2, h3, h4, h5 { 39 | color: var(--MAIN-TITLES-TEXT-color) !important; 40 | } 41 | 42 | a { 43 | color: var(--MAIN-LINK-color); 44 | } 45 | 46 | .anchor { 47 | color: var(--MAIN-ANCHOR-color); 48 | } 49 | 50 | a:hover { 51 | color: var(--MAIN-LINK-HOVER-color); 52 | } 53 | 54 | #sidebar ul li.visited > a .read-icon { 55 | color: var(--MENU-VISITED-color); 56 | } 57 | 58 | #body a.highlight:after { 59 | display: block; 60 | content: ""; 61 | height: 1px; 62 | width: 0%; 63 | -webkit-transition: width 0.5s ease; 64 | -moz-transition: width 0.5s ease; 65 | -ms-transition: width 0.5s ease; 66 | transition: width 0.5s ease; 67 | background-color: var(--MAIN-LINK-HOVER-color); 68 | } 69 | #sidebar { 70 | background-color: var(--MENU-SECTIONS-BG-color); 71 | } 72 | #sidebar #header-wrapper { 73 | background: var(--MENU-HEADER-BG-color); 74 | color: var(--MENU-SEARCH-BOX-color); 75 | border-color: var(--MENU-HEADER-BORDER-color); 76 | } 77 | #sidebar .searchbox { 78 | border-color: var(--MENU-SEARCH-BOX-color); 79 | background: var(--MENU-SEARCH-BG-color); 80 | } 81 | #sidebar ul.topics > li.parent, #sidebar ul.topics > li.active { 82 | background: var(--MENU-SECTIONS-ACTIVE-BG-color); 83 | } 84 | #sidebar .searchbox * { 85 | color: var(--MENU-SEARCH-BOX-ICONS-color); 86 | } 87 | 88 | #sidebar a { 89 | color: var(--MENU-SECTIONS-LINK-color); 90 | } 91 | 92 | #sidebar a:hover { 93 | color: var(--MENU-SECTIONS-LINK-HOVER-color); 94 | } 95 | 96 | #sidebar ul li.active > a { 97 | background: var(--MENU-SECTION-ACTIVE-CATEGORY-BG-color); 98 | color: var(--MENU-SECTION-ACTIVE-CATEGORY-color) !important; 99 | } 100 | 101 | #sidebar hr { 102 | border-color: var(--MENU-SECTION-HR-color); 103 | } 104 | 105 | blockquote { 106 | border-left: 10px solid #FA8072; 107 | } 108 | 109 | blockquote p { 110 | font-size: 1.1rem; 111 | color: #666; 112 | } -------------------------------------------------------------------------------- /content/intro/slides/index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | outputs: 3 | - Reveal 4 | title: Scientific R Markdown blog? 5 | hidden: true 6 | layout: list 7 | weight: 1 8 | output: hugodown::md_document 9 | rmd_hash: 348c660ed439e66c 10 | 11 | --- 12 | 13 | Scientific blogging with R Markdown 14 | =================================== 15 | 16 | :wave: Welcome! 17 | 18 | ------------------------------------------------------------------------ 19 | 20 | I'm Maëlle, I like R, blogging and science. 21 | 22 | {{% fragment %}} 23 | 24 | :house: https://masalmon.eu 25 | 26 | {{% /fragment %}} 27 | 28 | ------------------------------------------------------------------------ 29 | 30 | Why blog? 31 | ========= 32 | 33 | ------------------------------------------------------------------------ 34 | 35 | - Notes for future you 36 | 37 | - Passion for sharing? 38 | 39 | - Opportunities 40 | 41 | ------------------------------------------------------------------------ 42 | 43 | Teaching this course is an opportunity I got from blogging but blogging is not a pyramid scheme :wink: 44 | 45 | ------------------------------------------------------------------------ 46 | 47 | Why create blog? 48 | ================ 49 | 50 | What if I don't really want to blog regularly? 51 | 52 | 53 | 54 | - {{% fragment %}}Have a platform to share stuff when you need to.{{% /fragment %}} 55 | - {{% fragment %}}Portfolio. In particular, imagine someone recommending you for a thing.{{% /fragment %}} 56 | 57 | 58 | --------------------- 59 | 60 | What is a website? 61 | ================== 62 | 63 | - static: HTML, CSS, JS 64 | 65 | - non static: more machinery on the server side 66 | 67 | Online server somewhere. 68 | 69 | ------------------------------------------------------------------------ 70 | 71 | Why Rmd for blogging? 72 | ===================== 73 | 74 | - {{% fragment %}}Data analysis with R{{% /fragment %}} 75 | - {{% fragment %}}Blogging about R{{% /fragment %}} 76 | - {{% fragment %}}R as an utility tool e.g. to generate text from structured data{{% /fragment %}} 77 | - {{% fragment %}}knitr supports other languages...{{% /fragment %}} 78 | 79 | ------------------------------------------------------------------------ 80 | 81 | WHAT is a scientific Rmd blog? 82 | ============================== 83 | 84 | ------------------------------------------------------------------------ 85 | 86 | IMHO :smile_cat: 87 | 88 | I'll list criteria so we have something to compare our adventures to. 89 | 90 | ------------------------------------------------------------------------ 91 | 92 | Tech part 93 | ========= 94 | 95 | 96 | 97 | - {{% fragment %}}Easy way to update from Rmd without too much copy-pasting{{% /fragment %}} 98 | 99 | - {{% fragment %}}Fits into your existing workflow or uses things you want to learn and invest time in{{% /fragment %}} 100 | 101 | - {{% fragment %}}Code, syntax highlighting{{% /fragment %}} 102 | 103 | - {{% fragment %}}Modern tooling (html5? mobile friendly?){{% /fragment %}} 104 | 105 | 106 | --------------------- 107 | 108 | Science part 109 | ============ 110 | 111 | - {{% fragment %}}References from a .bib file{{% /fragment %}} 112 | 113 | - {{% fragment %}}Easy way to cite posts?{{% /fragment %}} 114 | 115 | - {{% fragment %}}Equations {{% /fragment %}} 116 | 117 | - {{% fragment %}}Content. Blog about science, or stuff relevant to science&co (e.g. comparisons of way to fit and present linear models in R).{{% /fragment %}} 118 | 119 | ------------------------------------------------------------------------ 120 | 121 | Human part 122 | ========== 123 | 124 | - {{% fragment %}}Accessible. Alt text, contrast. Don't add gate-keeping to science.{{% /fragment %}} 125 | 126 | - {{% fragment %}}You OWN it. Content, URL (no commercial service, no employer).{{% /fragment %}} 127 | 128 | - {{% fragment %}}Allows for interactions (social media? commenting?){{% /fragment %}} 129 | 130 | - {{% fragment %}}Costs a few dollars a month at most.{{% /fragment %}} 131 | 132 | ------------------------------------------------------------------------ 133 | 134 | Let's go 135 | ======== 136 | 137 | - {{% fragment %}}distill{{% /fragment %}} 138 | 139 | - {{% fragment %}}Hugo&hugodown{{% /fragment %}} 140 | 141 | - {{% fragment %}}WordPress{{% /fragment %}} 142 | 143 | - {{% fragment %}}Reproducibility{{% /fragment %}} 144 | 145 | - {{% fragment %}}Promotion{{% /fragment %}} 146 | 147 | - {{% fragment %}}Debrief{{% /fragment %}} 148 | 149 | ------------------------------------------------------------------------ 150 | 151 | We'll start with a tour of the course website 152 | ============================================= 153 | 154 | https://tiny.cc/rmd-blog 155 | 156 | -------------------------------------------------------------------------------- /static/countdown-0.3.5/countdown.js: -------------------------------------------------------------------------------- 1 | var counters = {timer: {}}; 2 | var update_timer = function(timer, force = false) { 3 | var secs = timer.value; 4 | 5 | // check if we should update timer or not 6 | noup = timer.div.className.match(/noupdate-\d+/); 7 | if (!force && noup != null) { 8 | noup = parseInt(noup[0].match(/\d+$/)); 9 | if (secs > noup * 2 && secs % noup > 0) { return; } 10 | } 11 | 12 | // should we apply or remove warning class? 13 | warnwhen = timer.div.dataset.warnwhen; 14 | if (warnwhen && warnwhen > 0) { 15 | if (secs <= warnwhen && !timer.div.classList.contains("warning")) { 16 | timer.div.classList.add("warning"); 17 | } else if (secs > warnwhen && timer.div.classList.contains("warning")) { 18 | timer.div.classList.remove("warning"); 19 | } 20 | } 21 | 22 | var mins = Math.floor(secs / 60); // 1 min = 60 secs 23 | secs -= mins * 60; 24 | 25 | // Update HTML 26 | timer.min.innerHTML = String(mins).padStart(2, 0); 27 | timer.sec.innerHTML = String(secs).padStart(2, 0); 28 | } 29 | var countdown = function (e) { 30 | target = e.target; 31 | if (target.classList.contains("countdown-digits")) { 32 | target = target.parentElement; 33 | } 34 | if (target.tagName == "CODE") { 35 | target = target.parentElement; 36 | } 37 | 38 | // Init counter 39 | if (!counters.timer.hasOwnProperty(target.id)) { 40 | counters.timer[target.id] = {}; 41 | // Set the containers 42 | counters.timer[target.id].min = target.getElementsByClassName("minutes")[0]; 43 | counters.timer[target.id].sec = target.getElementsByClassName("seconds")[0]; 44 | counters.timer[target.id].div = target; 45 | } 46 | 47 | if (!counters.timer[target.id].running) { 48 | if (!counters.timer[target.id].end) { 49 | counters.timer[target.id].end = parseInt(counters.timer[target.id].min.innerHTML) * 60; 50 | counters.timer[target.id].end += parseInt(counters.timer[target.id].sec.innerHTML); 51 | } 52 | 53 | counters.timer[target.id].value = counters.timer[target.id].end; 54 | update_timer(counters.timer[target.id]); 55 | if (counters.ticker) counters.timer[target.id].value += 1; 56 | 57 | // Start if not past end date 58 | if (counters.timer[target.id].value > 0) { 59 | base_class = target.className.replace(/\s?(running|finished)/, "") 60 | target.className = base_class + " running"; 61 | counters.timer[target.id].running = true; 62 | 63 | if (!counters.ticker) { 64 | counters.ticker = setInterval(counter_update_all, 1000); 65 | } 66 | } 67 | } else { 68 | // Bump timer value if running & clicked 69 | counters.timer[target.id].value += counter_bump_increment(counters.timer[target.id].end); 70 | update_timer(counters.timer[target.id], force = true); 71 | counters.timer[target.id].value += 1; 72 | } 73 | }; 74 | 75 | var counter_bump_increment = function(val) { 76 | if (val <= 30) { 77 | return 5; 78 | } else if (val <= 300) { 79 | return 15; 80 | } else if (val <= 3000) { 81 | return 30; 82 | } else { 83 | return 60; 84 | } 85 | } 86 | 87 | var counter_update_all = function() { 88 | // Iterate over all running timers 89 | for (var i in counters.timer) { 90 | // Stop if passed end time 91 | console.log(counters.timer[i].id) 92 | counters.timer[i].value--; 93 | if (counters.timer[i].value <= 0) { 94 | counters.timer[i].min.innerHTML = "00"; 95 | counters.timer[i].sec.innerHTML = "00"; 96 | counters.timer[i].div.className = counters.timer[i].div.className.replace("running", "finished"); 97 | counters.timer[i].running = false; 98 | } else { 99 | // Update 100 | update_timer(counters.timer[i]); 101 | 102 | // Play countdown sound if data-audio=true on container div 103 | let audio = counters.timer[i].div.dataset.audio 104 | if (audio && counters.timer[i].value == 5) { 105 | counter_play_sound(audio); 106 | } 107 | } 108 | } 109 | 110 | // If no more running timers, then clear ticker 111 | var timerIsRunning = false; 112 | for (var t in counters.timer) { 113 | timerIsRunning = timerIsRunning || counters.timer[t].running 114 | } 115 | if (!timerIsRunning) { 116 | clearInterval(counters.ticker); 117 | counters.ticker = null; 118 | } 119 | } 120 | 121 | var counter_play_sound = function(url) { 122 | if (typeof url === 'boolean') { 123 | url = 'libs/countdown/smb_stage_clear.mp3'; 124 | } 125 | sound = new Audio(url); 126 | sound.play(); 127 | } 128 | 129 | var counter_addEventListener = function() { 130 | if (!document.getElementsByClassName("countdown").length) { 131 | setTimeout(counter_addEventListener, 2); 132 | return; 133 | } 134 | var counter_divs = document.getElementsByClassName("countdown"); 135 | console.log(counter_divs); 136 | for (var i = 0; i < counter_divs.length; i++) { 137 | counter_divs[i].addEventListener("click", countdown, false); 138 | } 139 | }; 140 | 141 | counter_addEventListener(); 142 | -------------------------------------------------------------------------------- /content/hugo/slides/index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | outputs: 3 | - Reveal 4 | title: Hugo & hugodown 5 | hidden: true 6 | layout: list 7 | weight: 1 8 | output: hugodown::md_document 9 | countdown: true 10 | rmd_hash: 81064851377395ba 11 | 12 | --- 13 | 14 | Hugo and hugodown 15 | ================= 16 | 17 | A powerful static generator, a handy WIP package 18 | 19 | ------------------------------------------------------------------------ 20 | 21 | [Hugo](https://gohugo.io/) 22 | ========================== 23 | 24 | Powerful and fast static generator 25 | 26 | Only an .exe to install :tada: 27 | 28 | ------------------------------------------------------------------------ 29 | 30 | [hugodown](https://hugodown.r-lib.org/) 31 | ======================================= 32 | 33 | [R :package:](https://hugodown.r-lib.org/) 34 | 35 | - An R Markdown output format 36 | 37 | - Handy helpers 38 | 39 | Experimental but the best bet in my opinion. 40 | 41 | ------------------------------------------------------------------------ 42 | 43 | From Rmd to website 44 | =================== 45 | 46 | Under the hood 47 | 48 | {{}} 49 | graph LR; 50 | A[Rmd] --> |"R ( hugodown :package:,
downlit :package:)
& Pandoc"| B{md} 51 | B --> |"Hugo (Goldmark, Chroma)"| C[HTML] 52 | {{< /mermaid >}} 53 | 54 | Inspired by [Emi Tanaka's post](https://emitanaka.org/r/posts/2018-12-12-scientific-and-technical-blogging-radix-vs-blogdown/) 55 | 56 | ------------------------------------------------------------------------ 57 | 58 | From Rmd to website 59 | =================== 60 | 61 | What you do 62 | 63 | {{}} 64 | graph LR; 65 | A[Rmd] --> |":large_blue_circle: knit button"| B{md} 66 | B --> |"hugo build (locally or cloud)"| C[HTML] 67 | {{< /mermaid >}} 68 | 69 | ------------------------------------------------------------------------ 70 | 71 | No syntax highlighting :expressionless: 72 | 73 |
ggplot2::ggplot()
 74 | 
75 | 76 | Chroma syntax highlighting :+1: 77 | 78 | ```r 79 | ggplot2::ggplot() 80 | ``` 81 | 82 | downlit syntax highlighting :smiley: 83 | 84 |
85 | 86 |
ggplot2::ggplot()
87 | 88 |
89 | 90 | ------------------------------------------------------------------------ 91 | 92 | {{< figure src="/images/highlight.jpg" alt="A meme to explain why downlit is great" height="550" >}} 93 | 94 | Inspired by [Mara Averick](https://twitter.com/dataandme/status/1255510799273132032) 95 | 96 | ------------------------------------------------------------------------ 97 | 98 | hugodown syntax highlighting 99 | ============================ 100 | 101 | - downlit for R :tada: 102 | 103 | - Chroma for other languages :sparkles: 104 | 105 | ------------------------------------------------------------------------ 106 | 107 | :mountain_cableway: Time for a demo! 108 | 109 | [Notes on the course website](/hugo/demo/) 110 | 111 | ------------------------------------------------------------------------ 112 | 113 | Scientific Rmd Blog Checklist 114 | 115 | - [x] R Markdown 116 | - [x] Syntax highlighting 117 | - [x] Modern 118 | - [x] .bib 119 | - \[?\] Citation for posts (possible but custom layout) 120 | - [x] Equations 121 | 122 | ------------------------------------------------------------------------ 123 | 124 | Sustainability 125 | ============== 126 | 127 | Created by: 128 | 129 |
130 | 131 | Hadley Wickham \[aut, cre\] 132 | 133 |
134 | 135 | Used for [tidyverse.org](https://tidyverse.org), in particular. 136 | 137 | [Active development](https://github.com/r-lib/hugodown/). 138 | 139 | ------------------------------------------------------------------------ 140 | 141 | Limitations? 142 | ============ 143 | 144 | - hugodown is a WIP package. One easy to use theme only at the moment, but a great one! 145 | 146 | - Hugo changes a lot (but hugodown helps protect your projects from that) 147 | 148 | ------------------------------------------------------------------------ 149 | 150 | Further resources 151 | ================= 152 | 153 | [Listed on the course website](/hugo/further-resources/) :ledger: 154 | 155 | ------------------------------------------------------------------------ 156 | 157 | Questions, comments? 158 | ==================== 159 | 160 | Write them in the pad! 161 | 162 | ------------------------------------------------------------------------ 163 | 164 | Time for a break :tea: 165 | ====================== 166 | 167 | 168 | 169 |
170 | 171 | 05:00 172 | 173 |
174 | 175 | 176 | 177 | -------------------------------------------------------------------------------- /content/hugo/further-resources.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | menuTitle: Further resources 3 | title: More about Hugo & hugodown 4 | weight: 7 5 | --- 6 | 7 | ## Read the manual :wink: 8 | 9 | You can read the [whole hugodown docs](https://hugodown.r-lib.org/) and probably should especially as hugodown evolves. 10 | 11 | Also read the docs of the theme you choose. 12 | 13 | You might not need to read [Hugo docs](https://gohugo.io/documentation/), that are much longer, much more overwhelming: you mostly only need to read Hugo docs when you need to tweak or customize a theme. 14 | 15 | ## Follow developments? :eyes: 16 | 17 | If you start using Hugo & hugodown for your website... 18 | 19 | * [Watch development on GitHub](https://help.github.com/en/github/managing-subscriptions-and-notifications-on-github/viewing-your-subscriptions#configuring-your-watch-settings-for-an-individual-repository) of hugodown, of the theme? 20 | 21 | * Subscribe to the [hugodown issues](https://github.com/r-lib/hugodown/issues) that are interesting to you? 22 | 23 | ## Contributing guide for your website :pencil: 24 | 25 | Personal website: take notes to not forget what you tweaked, etc. 26 | 27 | Collaborative website: even Hugo users might not know your website structure! 28 | 29 | * [rOpenSci blog guide](https://blogguide.ropensci.org/) 30 | 31 | * [golemverse website contributing guide](https://github.com/ThinkR-open/golemverse.org/blob/master/how-to.Rmd) 32 | 33 | ## Where to get help? :wave: 34 | 35 | * [RStudio community forum](https://community.rstudio.com/c/R-Markdown/10) (RMarkdown category) 36 | 37 | * [hugodown issue tracker](https://github.com/r-lib/hugodown/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) 38 | 39 | * If you start tweaking Hugo templates, [Hugo forum](https://discourse.gohugo.io/) 40 | 41 | 42 | ## Hugo Academic :mortar_board: 43 | 44 | Hugo Academic has [excellent docs](https://sourcethemes.com/academic/docs/). 45 | 46 | You can build many different websites with Hugo Academic, see a few examples below. 47 | The theme is very versatile, and widely used in the R community. 48 | 49 | | Website | Source | 50 | |---|---| 51 | |[Yanina Bellini Saibene's personal website](https://yabellini.netlify.app/)| [](https://github.com/yabellini/SitioAcademico) | 52 | |[Metadocencia website](https://www.metadocencia.org/)| [](https://github.com/MetaDocencia/SitioWeb) | 53 | |[Personal website of Alison Presmanes Hill ](https://alison.rbind.io/)| [](https://github.com/rbind/apreshill) | 54 | |["Communicating with R Markdown" workshop by Alison Hill](https://ysc-rmarkdown.netlify.app/)| [](https://github.com/rstudio-education/communicate-rmd-workshop) | 55 | 56 | 57 | There's a [Python CLI to import your publications](https://github.com/sourcethemes/academic-admin), featured in [the blog post "Fixing Imports to Hugo"](https://dyerlab.org/post/fixing-imports-to-hugo/) 58 | 59 | ## Other Hugo themes :school_satchel: 60 | 61 | * Browse the [gallery](https://themes.gohugo.io/). [Choose your theme wisely](https://masalmon.eu/2020/02/29/hugo-maintenance/#choose-your-theme-wisely-and-keep-in-touch). Use Hugo docs to create new site. 62 | 63 | * [Hire someone](/webdev/hire/)? 64 | 65 | ## Another R package: blogdown :package: 66 | 67 | [blogdown](https://bookdown.org/yihui/blogdown/) is an alternative to hugodown. [hugodown vs blogdown](https://hugodown.r-lib.org/#compared-to-blogdown) 68 | 69 | ## Hugo and CMS :computer: 70 | 71 | To give a less technical interface to a Hugo website, you could use a CMS, see for instance [what Steph Locke set up in this website with Netlify CMS](https://github.com/hzi-braunschweig/serohub). 72 | 73 | ## Hugo template development/tweaking :nut_and_bolt: 74 | 75 | * How _I_ started: I needed to tweak one thing in an existing theme and I googled that thing; then I had to tweak one more thing; etc. Others might have built a theme from scratch. 76 | 77 | * [Mike Dane's tutorials](https://www.mikedane.com/static-site-generators/hugo/) 78 | 79 | * Threads indicating resources for beginners and the lack thereof: [2018](https://discourse.gohugo.io/t/comprehensive-hugo-tutorial-for-beginners/12586), [2019](https://discourse.gohugo.io/t/list-of-comprehensive-tutorials-for-beginners-2019/19654) 80 | 81 | * What you must know according to Steph Locke 82 | 83 | {{< tweet 1275677183915286531 >}} 84 | 85 | * More advanced 86 | 87 | {{< tweet 1275678631482834944 >}} 88 | 89 | * [Alison Hill's post on troubleshooting your build, and her other posts about Hugo](https://alison.rbind.io/post/2019-03-04-hugo-troubleshooting/), [Alison Hill's favourite Hugo resources](https://summer-of-blogdown.netlify.app/day-04/#deeper-dives) 90 | 91 | * [Lukas Burk posts about Hugo](https://blog.jemu.name/tags/hugo/) 92 | 93 | * [My Hugo posts on rOpenSci website](https://ropensci.org/tags/hugo/) and [on my blog](https://masalmon.eu/tags/hugo/) 94 | 95 | * [Julia Evan's blog post "Switching to Hugo"](https://jvns.ca/blog/2016/10/09/switching-to-hugo/) 96 | 97 | * [Tim Mastny's "Intro to Hugo: The Masterchef of Layouts"](https://timmastny.rbind.io/blog/intro-hugo-blogdown-chef/) 98 | 99 | -------------------------------------------------------------------------------- /content/wordpress/slides/index.en.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | outputs: 3 | - Reveal 4 | title: R Markdown & WordPress 5 | hidden: true 6 | layout: list 7 | weight: 1 8 | output: hugodown::md_document 9 | countdown: true 10 | --- 11 | 12 | # WordPress 13 | 14 | --- 15 | 16 | # Why use WordPress? 17 | 18 | * Clicking to design the interface 19 | 20 | * Internationalization 21 | 22 | * Open Source 23 | 24 | --- 25 | 26 | # Why NOT use WordPress 27 | 28 | * Performance? 29 | 30 | * Security? 31 | 32 | If you use WordPress, read the docs. 33 | 34 | --- 35 | 36 | # Do you use WordPress? 37 | 38 | --- 39 | 40 | # Workarounds for no WordPress 41 | 42 | * Use a subdomain for your R Markdown blog, linked from your main WordPress website. 43 | 44 | * [Netlify CMS](https://www.netlifycms.org/) and other CMS as an user-friendly interface on static websites (like Hugo). 45 | 46 | --- 47 | 48 | # Now, Rmd and WordPress! 49 | 50 | * `knitr::knit2wp()` is now too dated (it uses `RCurl` and `XML`) 51 | 52 | * I made a package using WordPress dot org API! 53 | 54 | * Bob Rudis' package for WordPress dot com API! 55 | 56 | So your choice is between a too old tool and WIP packages. :joy: :sob: 57 | 58 | --- 59 | 60 | # wordpress.com vs wordpress.org 61 | 62 | * Free/cheap wordpress.com: no plugin 63 | 64 | * Business wordpress.com: $$$ 65 | 66 | * Your own local server: efforts 67 | 68 | * Paid service hosting+domain name+ WordPress install: a few $ a month 69 | 70 | --- 71 | 72 | # JetPack 73 | 74 | Something you can add to any WordPress website (baked in dot com websites). 75 | 76 | Free and paid features. 77 | 78 | --- 79 | 80 | # Which API 81 | 82 | * wordpress dot com => .com API 83 | 84 | * self-hosted without JetPack => .org API 85 | 86 | * self-hosted with JetPack => .com API 87 | 88 | In my package, support for .org API, but .com coming. 89 | 90 | --- 91 | 92 | # From Rmd to website 93 | 94 | Under the hood 95 | 96 | ```{=html} 97 | {{}} 98 | graph LR; 99 | A[Rmd] --> |"R ( hugodown :package:,
downlit :package:)
& Pandoc"| B{md} 100 | B --> |"R (xml2 :package: )
& Pandoc"| C[HTML] 101 | C --> |"WordPress"| D[HTML] 102 | {{< /mermaid >}} 103 | ``` 104 | 105 | 106 | --- 107 | 108 | # From Rmd to website 109 | 110 | What you do 111 | 112 | ```{=html} 113 | {{}} 114 | graph LR; 115 | A[Rmd] --> |":large_blue_circle: knit button"| B{md} 116 | B --> |"run wp_post()"| C[HTML] 117 | C --> |"Wait"| D[HTML] 118 | {{< /mermaid >}} 119 | ``` 120 | 121 | 122 | --- 123 | 124 | # Setup for goodpress (0/3) 125 | 126 | Have a WordPress website that's not a free/cheap plan from wordpress.com :wink: 127 | 128 | [goodpress setup vignette](https://maelle.github.io/goodpress/articles/setup.html) 129 | 130 | --- 131 | 132 | # Setup for goodpress (1/3) 133 | 134 | * Install the [Application Passwords plugin](https://wordpress.org/plugins/application-passwords/) 135 | 136 | * Edit [.htaccess](https://github.com/WordPress/application-passwords/wiki/Basic-Authorization-Header----Missing) (with a plugin?) 137 | 138 | * Create an user with limited rights, and an application password for them. Save secrets in `.Renviron` 139 | 140 | --- 141 | 142 | # Setup for goodpress (2/3) 143 | 144 | For R syntax highlighting :sparkles: 145 | 146 | * Find [my code.css](https://github.com/maelle/goodpress/blob/main/inst/css/code.css) and copy it to your clipboard. 147 | 148 | * From your WordPress admin dasbhoard, go to Appearance > Customize > Additional CSS. Paste the CSS there and click on publish. 149 | 150 | --- 151 | 152 | # Setup for goodpress (3/3) 153 | 154 | If you want to use MathJax for equations. 155 | 156 | From WordPress interface go to Appearance > Theme Editor. 157 | In `` div of `header.php`, then save. 158 | 159 | ```html 160 | 161 | 162 | ``` 163 | 164 | --- 165 | 166 | :mountain_railway: Time for a demo! 167 | 168 | [Notes on the course website](/wordpress/demo/) 169 | 170 | --- 171 | 172 | Scientific Rmd Blog Checklist 173 | 174 | * [x] R Markdown 175 | * [x] Syntax highlighting (for R) 176 | * [x] Modern 177 | * [x] .bib 178 | * [?] Citation for posts (add it to all posts? WordPress theme?) 179 | * [x] Equations 180 | 181 | --- 182 | 183 | # Sustainability 184 | 185 | goodpress: 186 | 187 | ```{r, echo=FALSE, results="asis"} 188 | glue::glue_collapse( 189 | trimws( 190 | gsub(")$", "", 191 | gsub("<.*>", "", 192 | desc::desc_get_author(file = find.package("goodpress"), role = "aut") 193 | ) 194 | ) 195 | ), 196 | sep = ", ") 197 | ``` 198 | 199 | [Contributors welcome](https://github.com/maelle/goodpress/). 200 | 201 | pressur: 202 | 203 | ```{r, echo=FALSE, results="asis"} 204 | glue::glue_collapse( 205 | trimws( 206 | gsub(")$", "", 207 | gsub("<.*>", "", 208 | desc::desc_get_author(file = find.package("pressur"), role = "aut") 209 | ) 210 | ) 211 | ), 212 | sep = ", ") 213 | ``` 214 | 215 | 216 | 217 | --- 218 | 219 | # Limitations? 220 | 221 | * WordPress limitations (performance? security? how to tweak a theme) 222 | 223 | * The R part is promising but not stable yet 224 | 225 | --- 226 | 227 | # Further resources 228 | 229 | [Listed on the course website](/wordpress/further-resources/) :bookmark_tabs: 230 | 231 | --- 232 | 233 | # Questions, comments? 234 | 235 | Write them in the pad! 236 | 237 | --- 238 | 239 | # Time for a break :tropical_drink: 240 | 241 | 242 | 243 |
244 | 245 | 05:00 246 | 247 |
248 | 249 | -------------------------------------------------------------------------------- /static/css/pygments.css: -------------------------------------------------------------------------------- 1 | /* Background */ .chroma {background-color: #f8f8f8; border: solid gray 1px; } 2 | /* Other */ .chroma .x { } 3 | /* Error */ .chroma .err { } 4 | /* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; } 5 | /* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; width: auto; overflow: auto; display: block; } 6 | /* LineHighlight */ .chroma .hl { display: block; width: 100%;background-color: #ffffcc } 7 | /* LineNumbersTable */ .chroma .lnt { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #727272 } 8 | /* LineNumbers */ .chroma .ln { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #727272 } 9 | /* Keyword */ .chroma .k { color: #008000; font-weight: bold } 10 | /* KeywordConstant */ .chroma .kc { color: #008000; font-weight: bold } 11 | /* KeywordDeclaration */ .chroma .kd { color: #008000; font-weight: bold } 12 | /* KeywordNamespace */ .chroma .kn { color: #008000; font-weight: bold } 13 | /* KeywordPseudo */ .chroma .kp { color: #008000 } 14 | /* KeywordReserved */ .chroma .kr { color: #008000; font-weight: bold } 15 | /* KeywordType */ .chroma .kt { color: #b00040 } 16 | /* Name */ .chroma .n { } 17 | /* NameAttribute */ .chroma .na { color: #687720 } 18 | /* NameBuiltin */ .chroma .nb { color: #008000 } 19 | /* NameBuiltinPseudo */ .chroma .bp { } 20 | /* NameClass */ .chroma .nc { color: #0000ff; font-weight: bold } 21 | /* NameConstant */ .chroma .no { color: #880000 } 22 | /* NameDecorator */ .chroma .nd { color: #aa22ff } 23 | /* NameEntity */ .chroma .ni { color: #727272; font-weight: bold } 24 | /* NameException */ .chroma .ne { color: #d2413a; font-weight: bold } 25 | /* NameFunction */ .chroma .nf { color: #0000ff } 26 | /* NameFunctionMagic */ .chroma .fm { } 27 | /* NameLabel */ .chroma .nl { color: #a0a000 } 28 | /* NameNamespace */ .chroma .nn { color: #0000ff; font-weight: bold } 29 | /* NameOther */ .chroma .nx { } 30 | /* NameProperty */ .chroma .py { } 31 | /* NameTag */ .chroma .nt { color: #008000; font-weight: bold } 32 | /* NameVariable */ .chroma .nv { color: #19177c } 33 | /* NameVariableClass */ .chroma .vc { } 34 | /* NameVariableGlobal */ .chroma .vg { } 35 | /* NameVariableInstance */ .chroma .vi { } 36 | /* NameVariableMagic */ .chroma .vm { } 37 | /* Literal */ .chroma .l { } 38 | /* LiteralDate */ .chroma .ld { } 39 | /* LiteralString */ .chroma .s { color: #ba2121 } 40 | /* LiteralStringAffix */ .chroma .sa { color: #ba2121 } 41 | /* LiteralStringBacktick */ .chroma .sb { color: #ba2121 } 42 | /* LiteralStringChar */ .chroma .sc { color: #ba2121 } 43 | /* LiteralStringDelimiter */ .chroma .dl { color: #ba2121 } 44 | /* LiteralStringDoc */ .chroma .sd { color: #ba2121; font-style: italic } 45 | /* LiteralStringDouble */ .chroma .s2 { color: #ba2121 } 46 | /* LiteralStringEscape */ .chroma .se { color: #bb6622; font-weight: bold } 47 | /* LiteralStringHeredoc */ .chroma .sh { color: #ba2121 } 48 | /* LiteralStringInterpol */ .chroma .si { color: #bb6688; font-weight: bold } 49 | /* LiteralStringOther */ .chroma .sx { color: #008000 } 50 | /* LiteralStringRegex */ .chroma .sr { color: #bb6688 } 51 | /* LiteralStringSingle */ .chroma .s1 { color: #ba2121 } 52 | /* LiteralStringSymbol */ .chroma .ss { color: #19177c } 53 | /* LiteralNumber */ .chroma .m { color: #666666 } 54 | /* LiteralNumberBin */ .chroma .mb { color: #666666 } 55 | /* LiteralNumberFloat */ .chroma .mf { color: #666666 } 56 | /* LiteralNumberHex */ .chroma .mh { color: #666666 } 57 | /* LiteralNumberInteger */ .chroma .mi { color: #666666 } 58 | /* LiteralNumberIntegerLong */ .chroma .il { color: #666666 } 59 | /* LiteralNumberOct */ .chroma .mo { color: #666666 } 60 | /* Operator */ .chroma .o { color: #666666 } 61 | /* OperatorWord */ .chroma .ow { color: #aa22ff; font-weight: bold } 62 | /* Punctuation */ .chroma .p { color: #666 } 63 | /* Comment */ .chroma .c { color: #3b7777; font-style: italic } 64 | /* CommentHashbang */ .chroma .ch { color: #3b7777; font-style: italic } 65 | /* CommentMultiline */ .chroma .cm { color: #3b7777; font-style: italic } 66 | /* CommentSingle */ .chroma .c1 { color: #3b7777; font-style: italic } 67 | /* CommentSpecial */ .chroma .cs { color: #3b7777; font-style: italic } 68 | /* CommentPreproc */ .chroma .cp { color: #bc7a00 } 69 | /* CommentPreprocFile */ .chroma .cpf { color: #bc7a00 } 70 | /* Generic */ .chroma .g { } 71 | /* GenericDeleted */ .chroma .gd { color: #a00000 } 72 | /* GenericEmph */ .chroma .ge { font-style: italic } 73 | /* GenericError */ .chroma .gr { color: #ff0000 } 74 | /* GenericHeading */ .chroma .gh { color: #000080; font-weight: bold } 75 | /* GenericInserted */ .chroma .gi { color: #00a000 } 76 | /* GenericOutput */ .chroma .go { color: #888888 } 77 | /* GenericPrompt */ .chroma .gp { color: #000080; font-weight: bold } 78 | /* GenericStrong */ .chroma .gs { font-weight: bold } 79 | /* GenericSubheading */ .chroma .gu { color: #800080; font-weight: bold } 80 | /* GenericTraceback */ .chroma .gt { color: #0044dd } 81 | /* GenericUnderline */ .chroma .gl { text-decoration: underline } 82 | /* TextWhitespace */ .chroma .w { color: #bbbbbb } 83 | 84 | code { 85 | border-radius: 2px; 86 | white-space: nowrap; 87 | color: inherit; 88 | background: #f8f8f8; 89 | border: 1px solid #f8f8f8; 90 | padding: 0px 2px; 91 | } 92 | code + .copy-to-clipboard { 93 | margin-left: -1px; 94 | border-left: 0 !important; 95 | font-size: inherit !important; 96 | vertical-align: baseline; 97 | height: 21px; 98 | top: 0; 99 | } 100 | pre { 101 | padding: 1rem; 102 | margin: 2rem 0; 103 | background: #f8f8f8; 104 | border: 0; 105 | border-radius: 2px; 106 | line-height: 1.15; 107 | } 108 | pre code { 109 | color: inherit; 110 | background: inherit; 111 | white-space: inherit; 112 | border: 0; 113 | padding: 0; 114 | margin: 0; 115 | font-size: 15px; 116 | } 117 | 118 | #body code a.highlight { 119 | display: inline-flex; 120 | } 121 | 122 | #body pre code a.highlight { 123 | display: inline-flex; 124 | } 125 | 126 | .reveal code { 127 | font-size: inherit; 128 | } -------------------------------------------------------------------------------- /layouts/partials/menu.html: -------------------------------------------------------------------------------- 1 | 92 | 93 | 94 | {{ define "section-tree-nav" }} 95 | {{ $showvisitedlinks := .showvisitedlinks }} 96 | {{ $currentNode := .currentnode }} 97 | {{ $currentFileUniqueID := "" }} 98 | {{ with $currentNode.File }}{{ $currentFileUniqueID = .UniqueID }}{{ end }} 99 | {{with .sect}} 100 | {{if and .IsSection (or (not .Params.hidden) $.showhidden)}} 101 | {{safeHTML .Params.head}} 102 |
  • 107 | 108 | {{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}} 109 | {{ if $showvisitedlinks}} 110 | 111 | {{ end }} 112 | 113 | {{ $numberOfPages := (add (len .Pages) (len .Sections)) }} 114 | {{ if ne $numberOfPages 0 }} 115 |
      116 | {{ if .Params.slides }} 117 |
    • 118 | 119 | Slides 120 | 121 |
    • 122 | {{ end }} 123 | {{ $currentNode.Scratch.Set "pages" .Pages }} 124 | {{ if .Sections}} 125 | {{ $currentNode.Scratch.Set "pages" (.Pages | union .Sections) }} 126 | {{end}} 127 | {{ $pages := ($currentNode.Scratch.Get "pages") }} 128 | 129 | {{if eq .Site.Params.ordersectionsby "title"}} 130 | {{ range $pages.ByTitle }} 131 | {{ if and .Params.hidden (not $.showhidden) }} 132 | {{else}} 133 | {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks }} 134 | {{end}} 135 | {{ end }} 136 | {{else}} 137 | {{ range $pages.ByWeight }} 138 | {{ if and .Params.hidden (not $.showhidden) }} 139 | {{else}} 140 | {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks }} 141 | {{end}} 142 | {{ end }} 143 | {{end}} 144 |
    145 | {{ end }} 146 |
  • 147 | {{else}} 148 | {{ if not .Params.Hidden }} 149 |
  • 150 | 151 | {{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}} 152 | {{ if $showvisitedlinks}}{{end}} 153 | 154 |
  • 155 | {{ end }} 156 | {{end}} 157 | {{ end }} 158 | {{ end }} -------------------------------------------------------------------------------- /content/wordpress/slides/index.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | outputs: 3 | - Reveal 4 | title: R Markdown & WordPress 5 | hidden: true 6 | layout: list 7 | weight: 1 8 | output: hugodown::md_document 9 | countdown: true 10 | rmd_hash: 7f271775f150fbfa 11 | 12 | --- 13 | 14 | WordPress 15 | ========= 16 | 17 | ------------------------------------------------------------------------ 18 | 19 | Why use WordPress? 20 | ================== 21 | 22 | - Clicking to design the interface 23 | 24 | - Internationalization 25 | 26 | - Open Source 27 | 28 | ------------------------------------------------------------------------ 29 | 30 | Why NOT use WordPress 31 | ===================== 32 | 33 | - Performance? 34 | 35 | - Security? 36 | 37 | If you use WordPress, read the docs. 38 | 39 | ------------------------------------------------------------------------ 40 | 41 | Do you use WordPress? 42 | ===================== 43 | 44 | ------------------------------------------------------------------------ 45 | 46 | Workarounds for no WordPress 47 | ============================ 48 | 49 | - Use a subdomain for your R Markdown blog, linked from your main WordPress website. 50 | 51 | - [Netlify CMS](https://www.netlifycms.org/) and other CMS as an user-friendly interface on static websites (like Hugo). 52 | 53 | ------------------------------------------------------------------------ 54 | 55 | Now, Rmd and WordPress! 56 | ======================= 57 | 58 | - [`knitr::knit2wp()`](https://rdrr.io/pkg/knitr/man/knit2wp.html) is now too dated (it uses `RCurl` and `XML`) 59 | 60 | - I made a package using WordPress dot org API! 61 | 62 | - Bob Rudis' package for WordPress dot com API! 63 | 64 | So your choice is between a too old tool and WIP packages. :joy: :sob: 65 | 66 | ------------------------------------------------------------------------ 67 | 68 | wordpress.com vs wordpress.org 69 | ============================== 70 | 71 | - Free/cheap wordpress.com: no plugin 72 | 73 | - Business wordpress.com: \$\$\$ 74 | 75 | - Your own local server: efforts 76 | 77 | - Paid service hosting+domain name+ WordPress install: a few \$ a month 78 | 79 | ------------------------------------------------------------------------ 80 | 81 | JetPack 82 | ======= 83 | 84 | Something you can add to any WordPress website (baked in dot com websites). 85 | 86 | Free and paid features. 87 | 88 | ------------------------------------------------------------------------ 89 | 90 | Which API 91 | ========= 92 | 93 | - wordpress dot com => .com API 94 | 95 | - self-hosted without JetPack => .org API 96 | 97 | - self-hosted with JetPack => .com API 98 | 99 | In my package, support for .org API, but .com coming. 100 | 101 | ------------------------------------------------------------------------ 102 | 103 | From Rmd to website 104 | =================== 105 | 106 | Under the hood 107 | 108 | {{}} 109 | graph LR; 110 | A[Rmd] --> |"R ( hugodown :package:,
    downlit :package:)
    & Pandoc"| B{md} 111 | B --> |"R (xml2 :package: )
    & Pandoc"| C[HTML] 112 | C --> |"WordPress"| D[HTML] 113 | {{< /mermaid >}} 114 | 115 | ------------------------------------------------------------------------ 116 | 117 | From Rmd to website 118 | =================== 119 | 120 | What you do 121 | 122 | {{}} 123 | graph LR; 124 | A[Rmd] --> |":large_blue_circle: knit button"| B{md} 125 | B --> |"run wp_post()"| C[HTML] 126 | C --> |"Wait"| D[HTML] 127 | {{< /mermaid >}} 128 | 129 | ------------------------------------------------------------------------ 130 | 131 | Setup for goodpress (0/3) 132 | ========================= 133 | 134 | Have a WordPress website that's not a free/cheap plan from wordpress.com :wink: 135 | 136 | [goodpress setup vignette](https://maelle.github.io/goodpress/articles/setup.html) 137 | 138 | ------------------------------------------------------------------------ 139 | 140 | Setup for goodpress (1/3) 141 | ========================= 142 | 143 | - Install the [Application Passwords plugin](https://wordpress.org/plugins/application-passwords/) 144 | 145 | - Edit [.htaccess](https://github.com/WordPress/application-passwords/wiki/Basic-Authorization-Header----Missing) (with a plugin?) 146 | 147 | - Create an user with limited rights, and an application password for them. Save secrets in `.Renviron` 148 | 149 | ------------------------------------------------------------------------ 150 | 151 | Setup for goodpress (2/3) 152 | ========================= 153 | 154 | For R syntax highlighting :sparkles: 155 | 156 | - Find [my code.css](https://github.com/maelle/goodpress/blob/main/inst/css/code.css) and copy it to your clipboard. 157 | 158 | - From your WordPress admin dasbhoard, go to Appearance > Customize > Additional CSS. Paste the CSS there and click on publish. 159 | 160 | ------------------------------------------------------------------------ 161 | 162 | Setup for goodpress (3/3) 163 | ========================= 164 | 165 | If you want to use MathJax for equations. 166 | 167 | From WordPress interface go to Appearance > Theme Editor. In `` div of `header.php`, then save. 168 | 169 | ``` html 170 | 171 | 172 | ``` 173 | 174 | ------------------------------------------------------------------------ 175 | 176 | :mountain_railway: Time for a demo! 177 | 178 | [Notes on the course website](/wordpress/demo/) 179 | 180 | ------------------------------------------------------------------------ 181 | 182 | Scientific Rmd Blog Checklist 183 | 184 | - [x] R Markdown 185 | - [x] Syntax highlighting (for R) 186 | - [x] Modern 187 | - [x] .bib 188 | - \[?\] Citation for posts (add it to all posts? WordPress theme?) 189 | - [x] Equations 190 | 191 | ------------------------------------------------------------------------ 192 | 193 | Sustainability 194 | ============== 195 | 196 | goodpress: 197 | 198 |
    199 | 200 | Maëlle Salmon 201 | 202 |
    203 | 204 | [Contributors welcome](https://github.com/maelle/goodpress/). 205 | 206 | pressur: 207 | 208 |
    209 | 210 | Bob Rudis 211 | 212 |
    213 | 214 | ------------------------------------------------------------------------ 215 | 216 | Limitations? 217 | ============ 218 | 219 | - WordPress limitations (performance? security? how to tweak a theme) 220 | 221 | - The R part is promising but not stable yet 222 | 223 | ------------------------------------------------------------------------ 224 | 225 | Further resources 226 | ================= 227 | 228 | [Listed on the course website](/wordpress/further-resources/) :bookmark_tabs: 229 | 230 | ------------------------------------------------------------------------ 231 | 232 | Questions, comments? 233 | ==================== 234 | 235 | Write them in the pad! 236 | 237 | ------------------------------------------------------------------------ 238 | 239 | Time for a break :tropical_drink: 240 | ================================= 241 | 242 | 243 | 244 |
    245 | 246 | 05:00 247 | 248 |
    249 | 250 | 251 | 252 | -------------------------------------------------------------------------------- /content/snippets.en.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Snippets 3 | weight: 1 4 | hidden: true 5 | chapter: false 6 | disableToc: false 7 | --- 8 | 9 | For copy-pasting during demos. 10 | 11 | ## Title 12 | 13 | ```markdown 14 | An Awesome Stressless Post 15 | ``` 16 | 17 | ## Content 18 | 19 | ````markdown 20 | In this post, we shall see stuff. 21 | 22 | ## A section 23 | 24 | Some code below 25 | 26 | ```{r} 27 | a <- 1:10 28 | plot(a) 29 | ``` 30 | 31 | ```` 32 | 33 | ## Setup chunk 34 | 35 | ````markdown 36 | ```{r setup, include=FALSE} 37 | knitr::opts_chunk$set( 38 | echo = TRUE, 39 | warning = TRUE, 40 | message = TRUE, 41 | comment = "" 42 | ) 43 | ``` 44 | ```` 45 | 46 | ## Bibliography 47 | 48 | ### Markdown part 49 | 50 | ```markdown 51 | what a nice package[@refmanager] built on top of R[@my-citation-key-for-r]. 52 | ``` 53 | 54 | ### References 55 | 56 | ```bib 57 | @Manual{my-citation-key-for-r, 58 | title = {R: A Language and Environment for Statistical Computing}, 59 | author = {{R Core Team}}, 60 | organization = {R Foundation for Statistical Computing}, 61 | address = {Vienna, Austria}, 62 | year = {2020}, 63 | url = {https://www.R-project.org/}, 64 | } 65 | 66 | @Article{refmanager, 67 | author = {Mathew William McLean}, 68 | title = {RefManageR: Import and Manage BibTeX and BibLaTeX References in R}, 69 | journal = {The Journal of Open Source Software}, 70 | year = {2017}, 71 | doi = {10.21105/joss.00338}, 72 | } 73 | 74 | @Manual{jqr, 75 | title = {jqr: Client for 'jq', a 'JSON' Processor}, 76 | author = {Rich FitzJohn and Jeroen Ooms and Scott Chamberlain and {Stefan Milton Bache}}, 77 | year = {2018}, 78 | note = {R package version 1.1.0}, 79 | url = {https://CRAN.R-project.org/package=jqr}, 80 | } 81 | 82 | ``` 83 | 84 | ### CSL 85 | 86 | From the [official repository for Citation Style Language (CSL) citation styles](https://github.com/citation-style-language/styles/blob/master/chicago-fullnote-bibliography.csl), CSL for _Chicago Manual of Style 17th edition (full note)_. 87 | 88 | ```xml 89 | 90 | 1540 | ``` 1541 | 1542 | ## Mathematics 1543 | 1544 | From [MathJax docs](http://docs.mathjax.org/en/latest/basic/mathematics.html). 1545 | 1546 | ```markdown 1547 | When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are 1548 | $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$ 1549 | ``` 1550 | 1551 | ## Distill custom CSS 1552 | 1553 | ```yaml 1554 | output: 1555 | distill::distill_article: 1556 | css: styles.css 1557 | ``` 1558 | 1559 | ## Distill navbar 1560 | 1561 | ```yaml 1562 | navbar: 1563 | right: 1564 | - text: "Home" 1565 | href: index.html 1566 | - text: "About" 1567 | href: about.html 1568 | - icon: fa fa-twitter 1569 | href: https://twitter.com/ma_salmon 1570 | - icon: fa fa-github 1571 | href: https://github.com/maelle 1572 | ``` 1573 | 1574 | ## hugodown about page 1575 | 1576 | ````markdown 1577 | --- 1578 | title: About my website 1579 | author: Maëlle Salmon 1580 | --- 1581 | 1582 | This is a website created to show how to create a new site, a theme, and how to patch it for hugodown compatibility. 1583 | 1584 | ```` 1585 | 1586 | ## hugodown post YAML 1587 | 1588 | ````markdown 1589 | --- 1590 | title: "Post created with Rmd yay" 1591 | date: "2020-06-25" 1592 | slug: "post-slug" 1593 | status: "publish" 1594 | output: hugodown::md_document 1595 | categories: 1596 | - math 1597 | - Code and Stuff 1598 | tags: 1599 | - crul 1600 | - mathjax 1601 | - R packages 1602 | --- 1603 | ```` 1604 | 1605 | ## hugodown post body 1606 | 1607 | ````markdown 1608 | 1609 | 1610 | ```{r setup, include=FALSE} 1611 | knitr::opts_chunk$set(echo = TRUE) 1612 | ``` 1613 | 1614 | ## Nice subsection 1615 | 1616 | [A link](https://masalmon.eu) 1617 | 1618 | Some inline code, `crul::ok()`. 1619 | 1620 | ```{r eval=FALSE} 1621 | usethis::use_git() 1622 | ggplot(mtcars) 1623 | plot(1:19) 1624 | a <- TRUE 1625 | ``` 1626 | 1627 | ## Plot 1628 | 1629 | ```{r plot-hist} 1630 | hist(rnorm(10000)) 1631 | ``` 1632 | 1633 | 1634 | ```` 1635 | 1636 | 1637 | ## code.css 1638 | 1639 | Adapted from [the stylesheet of this website (for which I added contrast to the default pygments Chroma style)](https://github.com/maelle/goodpress/blob/main/inst/css/code.css) 1640 | 1641 | ```css 1642 | /* Background */ .chroma {background-color: #f8f8f8; border: solid gray 1px; } 1643 | /* Other */ .chroma .x { } 1644 | /* Error */ .chroma .err { } 1645 | /* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; } 1646 | /* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; width: auto; overflow: auto; display: block; } 1647 | /* LineHighlight */ .chroma .hl { display: block; width: 100%;background-color: #ffffcc } 1648 | /* LineNumbersTable */ .chroma .lnt { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #727272 } 1649 | /* LineNumbers */ .chroma .ln { margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #727272 } 1650 | /* Keyword */ .chroma .k { color: #008000; font-weight: bold } 1651 | /* KeywordConstant */ .chroma .kc { color: #008000; font-weight: bold } 1652 | /* KeywordDeclaration */ .chroma .kd { color: #008000; font-weight: bold } 1653 | /* KeywordNamespace */ .chroma .kn { color: #008000; font-weight: bold } 1654 | /* KeywordPseudo */ .chroma .kp { color: #008000 } 1655 | /* KeywordReserved */ .chroma .kr { color: #008000; font-weight: bold } 1656 | /* KeywordType */ .chroma .kt { color: #b00040 } 1657 | /* Name */ .chroma .n { } 1658 | /* NameAttribute */ .chroma .na { color: #687720 } 1659 | /* NameBuiltin */ .chroma .nb { color: #008000 } 1660 | /* NameBuiltinPseudo */ .chroma .bp { } 1661 | /* NameClass */ .chroma .nc { color: #0000ff; font-weight: bold } 1662 | /* NameConstant */ .chroma .no { color: #880000 } 1663 | /* NameDecorator */ .chroma .nd { color: #aa22ff } 1664 | /* NameEntity */ .chroma .ni { color: #727272; font-weight: bold } 1665 | /* NameException */ .chroma .ne { color: #d2413a; font-weight: bold } 1666 | /* NameFunction */ .chroma .nf { color: #0000ff } 1667 | /* NameFunctionMagic */ .chroma .fm { } 1668 | /* NameLabel */ .chroma .nl { color: #a0a000 } 1669 | /* NameNamespace */ .chroma .nn { color: #0000ff; font-weight: bold } 1670 | /* NameOther */ .chroma .nx { } 1671 | /* NameProperty */ .chroma .py { } 1672 | /* NameTag */ .chroma .nt { color: #008000; font-weight: bold } 1673 | /* NameVariable */ .chroma .nv { color: #19177c } 1674 | /* NameVariableClass */ .chroma .vc { } 1675 | /* NameVariableGlobal */ .chroma .vg { } 1676 | /* NameVariableInstance */ .chroma .vi { } 1677 | /* NameVariableMagic */ .chroma .vm { } 1678 | /* Literal */ .chroma .l { } 1679 | /* LiteralDate */ .chroma .ld { } 1680 | /* LiteralString */ .chroma .s { color: #ba2121 } 1681 | /* LiteralStringAffix */ .chroma .sa { color: #ba2121 } 1682 | /* LiteralStringBacktick */ .chroma .sb { color: #ba2121 } 1683 | /* LiteralStringChar */ .chroma .sc { color: #ba2121 } 1684 | /* LiteralStringDelimiter */ .chroma .dl { color: #ba2121 } 1685 | /* LiteralStringDoc */ .chroma .sd { color: #ba2121; font-style: italic } 1686 | /* LiteralStringDouble */ .chroma .s2 { color: #ba2121 } 1687 | /* LiteralStringEscape */ .chroma .se { color: #bb6622; font-weight: bold } 1688 | /* LiteralStringHeredoc */ .chroma .sh { color: #ba2121 } 1689 | /* LiteralStringInterpol */ .chroma .si { color: #bb6688; font-weight: bold } 1690 | /* LiteralStringOther */ .chroma .sx { color: #008000 } 1691 | /* LiteralStringRegex */ .chroma .sr { color: #bb6688 } 1692 | /* LiteralStringSingle */ .chroma .s1 { color: #ba2121 } 1693 | /* LiteralStringSymbol */ .chroma .ss { color: #19177c } 1694 | /* LiteralNumber */ .chroma .m { color: #666666 } 1695 | /* LiteralNumberBin */ .chroma .mb { color: #666666 } 1696 | /* LiteralNumberFloat */ .chroma .mf { color: #666666 } 1697 | /* LiteralNumberHex */ .chroma .mh { color: #666666 } 1698 | /* LiteralNumberInteger */ .chroma .mi { color: #666666 } 1699 | /* LiteralNumberIntegerLong */ .chroma .il { color: #666666 } 1700 | /* LiteralNumberOct */ .chroma .mo { color: #666666 } 1701 | /* Operator */ .chroma .o { color: #666666 } 1702 | /* OperatorWord */ .chroma .ow { color: #aa22ff; font-weight: bold } 1703 | /* Punctuation */ .chroma .p { color: #666 } 1704 | /* Comment */ .chroma .c { color: #3b7777; font-style: italic } 1705 | /* CommentHashbang */ .chroma .ch { color: #3b7777; font-style: italic } 1706 | /* CommentMultiline */ .chroma .cm { color: #3b7777; font-style: italic } 1707 | /* CommentSingle */ .chroma .c1 { color: #3b7777; font-style: italic } 1708 | /* CommentSpecial */ .chroma .cs { color: #3b7777; font-style: italic } 1709 | /* CommentPreproc */ .chroma .cp { color: #bc7a00 } 1710 | /* CommentPreprocFile */ .chroma .cpf { color: #bc7a00 } 1711 | /* Generic */ .chroma .g { } 1712 | /* GenericDeleted */ .chroma .gd { color: #a00000 } 1713 | /* GenericEmph */ .chroma .ge { font-style: italic } 1714 | /* GenericError */ .chroma .gr { color: #ff0000 } 1715 | /* GenericHeading */ .chroma .gh { color: #000080; font-weight: bold } 1716 | /* GenericInserted */ .chroma .gi { color: #00a000 } 1717 | /* GenericOutput */ .chroma .go { color: #888888 } 1718 | /* GenericPrompt */ .chroma .gp { color: #000080; font-weight: bold } 1719 | /* GenericStrong */ .chroma .gs { font-weight: bold } 1720 | /* GenericSubheading */ .chroma .gu { color: #800080; font-weight: bold } 1721 | /* GenericTraceback */ .chroma .gt { color: #0044dd } 1722 | /* GenericUnderline */ .chroma .gl { text-decoration: underline } 1723 | /* TextWhitespace */ .chroma .w { color: #bbbbbb } 1724 | 1725 | code { 1726 | border-radius: 2px; 1727 | white-space: nowrap; 1728 | color: inherit; 1729 | background: #f8f8f8; 1730 | border: 1px solid #f8f8f8; 1731 | padding: 0px 2px; 1732 | } 1733 | code + .copy-to-clipboard { 1734 | margin-left: -1px; 1735 | border-left: 0 !important; 1736 | font-size: inherit !important; 1737 | vertical-align: baseline; 1738 | height: 21px; 1739 | top: 0; 1740 | } 1741 | pre { 1742 | padding: 1rem; 1743 | margin: 2rem 0; 1744 | background: #f8f8f8; 1745 | border: 0; 1746 | border-radius: 2px; 1747 | line-height: 1.15; 1748 | } 1749 | pre code { 1750 | color: inherit; 1751 | background: inherit; 1752 | white-space: inherit; 1753 | border: 0; 1754 | padding: 0; 1755 | margin: 0; 1756 | font-size: 15px; 1757 | } 1758 | 1759 | #body code a.highlight { 1760 | display: inline-flex; 1761 | } 1762 | 1763 | #body pre code a.highlight { 1764 | display: inline-flex; 1765 | } 1766 | 1767 | ``` 1768 | 1769 | ## head_custom.html 1770 | 1771 | ```html 1772 | 1773 | ``` 1774 | 1775 | ## foot_custom.html 1776 | 1777 | ```html 1778 | 1779 | 1781 | ``` 1782 | 1783 | ## goodpress post 1784 | 1785 | ````markdown 1786 | --- 1787 | title: "Post created with Rmd yay" 1788 | date: "2020-06-25T00:00:00" 1789 | slug: "post-slug" 1790 | excerpt: "Here I summarize this fantastic post" 1791 | status: "publish" 1792 | output: hugodown::md_document 1793 | categories: 1794 | - math 1795 | - Code and Stuff 1796 | tags: 1797 | - crul 1798 | - mathjax 1799 | - R packages 1800 | comment_status: open 1801 | ping_status: open 1802 | --- 1803 | 1804 | ```{r setup, include=FALSE} 1805 | knitr::opts_chunk$set(echo = TRUE) 1806 | ``` 1807 | 1808 | ## Nice subsection 1809 | 1810 | [A link](https://masalmon.eu) 1811 | 1812 | Some inline code, `crul::ok()`. 1813 | 1814 | ```{r eval=FALSE} 1815 | usethis::use_git() 1816 | ggplot(mtcars) 1817 | plot(1:19) 1818 | a <- TRUE 1819 | ``` 1820 | 1821 | ## Maths 1822 | 1823 | When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are 1824 | 1825 | $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$ 1826 | 1827 | $$x = a_0 + \frac{1}{a_1 + \frac{1}{a_2 + \frac{1}{a_3 + a_4}}} $$ 1828 | 1829 | 1830 | ## Plot 1831 | 1832 | ```{r plot-hist} 1833 | hist(rnorm(10000)) 1834 | ``` 1835 | 1836 | ```` --------------------------------------------------------------------------------