From 63d76c3955da57e97abccf69f89b32f036644217 Mon Sep 17 00:00:00 2001 From: Alison Hill Date: Fri, 8 May 2020 14:24:25 -0700 Subject: [PATCH 1/3] test out by adding new section-level parameter to turn on/off clipboard button --- content/learn/_index.md | 1 + content/start/_index.md | 1 + 2 files changed, 2 insertions(+) diff --git a/content/learn/_index.md b/content/learn/_index.md index 8dbb371c..4505443c 100644 --- a/content/learn/_index.md +++ b/content/learn/_index.md @@ -2,6 +2,7 @@ title: Learn description: "Learn how to go farther with tidymodels in your modeling and machine learning projects." icon_attribution: "Icons made by [Becris](https://www.flaticon.com/authors/becris) from www.flaticon.com" +copy_clipboard: false --- After you know [what you need to get started](/start/) with tidymodels, you can learn more and go further. Find articles here to help you solve specific problems using the tidymodels framework. Articles are organized into four categories: diff --git a/content/start/_index.md b/content/start/_index.md index be4746ab..56cfe366 100644 --- a/content/start/_index.md +++ b/content/start/_index.md @@ -2,6 +2,7 @@ title: Get Started subtitle: Welcome! description: "What do you need to know to start using tidymodels? Learn what you need in 5 articles." +copy_clipboard: true --- Here, learn what you need to get started with tidymodels in five articles, starting with how to create a model and ending with a beginning-to-end modeling case study. After you are comfortable with these basics, you can [learn how to go farther with tidymodels](/learn/). From 608578fa12eba5a57020c39221fc97b59445a815 Mon Sep 17 00:00:00 2001 From: Alison Hill Date: Fri, 8 May 2020 14:24:54 -0700 Subject: [PATCH 2/3] create global parameter for copy to clipboard switch for whole site --- config/_default/params.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/_default/params.toml b/config/_default/params.toml index c7a8b8d4..344bf747 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -1,6 +1,10 @@ # Description for social sharing and search engines. description = "A collection of R packages for modeling and machine learning using tidyverse principles." +# Enable copy-to-clipboard for all code? +# Can also enable by content section in _index.md file +copy_clipboard = false + # Default image for social sharing and search engines. Place image in `static/images/` folder and specify image name here. sharing_image = "feature_summary_large_image.jpg" twitter_image = "feature_summary_large_image.jpg" From 3b52839bec2c309588d8117f8ca735199ef10831 Mon Sep 17 00:00:00 2001 From: Alison Hill Date: Fri, 8 May 2020 14:25:31 -0700 Subject: [PATCH 3/3] makes copy to clipboard conditional on either site param = TRUE or section parameter = TRUE --- layouts/partials/head_custom.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/layouts/partials/head_custom.html b/layouts/partials/head_custom.html index dc4d47a7..63d26510 100644 --- a/layouts/partials/head_custom.html +++ b/layouts/partials/head_custom.html @@ -1,6 +1,15 @@ +{{ $clipboard_site := $.Site.Params.copy_clipboard }} +{{ $page := . }} + + +{{ with $page.FirstSection }} + {{ if or (.Params.Copy_clipboard) ($clipboard_site) }} + + {{ end }} +{{ end }}