pkgdown icon indicating copy to clipboard operation
pkgdown copied to clipboard

Allow for external links in articles page

Open EmilHvitfeldt opened this issue 2 years ago • 3 comments

In recipes, we have a couple of articles that got moved away from the package itself to other sites. It would be nice if we could link externally from the articles page.

Below is an old yaml section that can't be updated to bs5

  - text: "Articles"
    menu:
      - text: "Selecting Variables"
        href: articles/Selecting_Variables.html
      - text: "Custom Steps"
        href: https://www.tidymodels.org/learn/develop/recipes/
      - text: "The Order of Steps"
        href: articles/Ordering.html
      - text: "Dummy Variables and Interactions"
        href: articles/Dummies.html
      - text: "Column Roles"
        href: articles/Roles.html
      - text: "On Skipping Steps"
        href: articles/Skipping.html
      - text: "Subsampling for Class Imbalances"
        href: https://www.tidymodels.org/learn/models/sub-sampling/
      - text: "Multivariate Analysis using Partial Least Squares"
        href: https://www.tidymodels.org/learn/models/pls/

Below is what would be nice if it was possible (imaginary syntax)

articles:
- title: About recipe Steps
  navbar: ~
  contents:
  - Selecting_Variables
  - Ordering
  - Dummies
  - Roles
  - Skipping
- title: Developer
  contents:
  - text: Custom Steps
    desc: Write a new recipe step for data preprocessing.
    href: https://www.tidymodels.org/learn/develop/recipes/
- title: Examples
  contents:
  - text: Subsampling for Class Imbalances
    desc: Improve model performance in imbalanced data sets through undersampling or oversampling.
    href: https://www.tidymodels.org/learn/models/sub-sampling/
  - text: Multivariate Analysis using Partial Least Squares
    desc: Build and fit a predictive model with more than one outcome.
    href: https://www.tidymodels.org/learn/models/pls/

EmilHvitfeldt avatar Jan 21 '22 19:01 EmilHvitfeldt

We should copy the syntax we used for references.

hadley avatar Apr 17 '24 22:04 hadley

The syntax for external reference topics is just pkg::topic_name, which obviously isn't going to apply to articles.

Presumably you'll also want to be able to mix and match within a section, e.g.

articles:
- title: About recipe Steps
  navbar: ~
  contents:
  - Selecting_Variables
  - Ordering
  - Dummies
  - Roles
  - Skipping
  - text: Custom Steps
    desc: Write a new recipe step for data preprocessing.
    href: https://www.tidymodels.org/learn/develop/recipes/

That's going to make parsing rather complicated, since contents can use -,starts_with() etc, so maybe it would be simpler to have an external-articles section that provides a lookup table:

articles:
- title: About recipe Steps
  navbar: ~
  contents:
  - Selecting_Variables
  - Ordering
  - Dummies
  - Roles
  - Skipping
- title: Developer
  contents:
  - custom
- title: Examples
  contents:
  - subsampling
  - pls

external-articles:
- name: subsampling
  text: Subsampling for Class Imbalances
  desc: Improve model performance in imbalanced data sets through undersampling or oversampling.
  href: https://www.tidymodels.org/learn/models/sub-sampling/
- name: pls
  text: Multivariate Analysis using Partial Least Squares
  desc: Build and fit a predictive model with more than one outcome.
  href: https://www.tidymodels.org/learn/models/pls/
- name: custom 
  text: Custom Steps
  desc: Write a new recipe step for data preprocessing.
  href: https://www.tidymodels.org/learn/develop/recipes/

What do you think of that @EmilHvitfeldt?

hadley avatar Apr 24 '24 13:04 hadley

that sounds good to me

EmilHvitfeldt avatar Apr 24 '24 15:04 EmilHvitfeldt