Notes against anti-patterns in Site.R
by Alan Wang on July 22, 2022
Source:vignettes/anti-patterns.Rmd
anti-patterns.Rmd
When I first started to utilize the site.R
script, I
found it helpful to understand which elements exists and how they can
and cannot be used to create a website. This tutorial is aimed to give
the users a slightly deeper understanding of the package by eliminating
implicit knowledge. If you haven’t already, I would first read the quick-start
guide before continuing with this tutorial.
Attributes:
- Singleton: A singleton is an element that can only occur once in a site. For example, you cannot create multiple navbars
Page Elements:
-
page_head:
- This element seems to be replaced by the last time it is called. In other words, if you call this element twice, only the latest call is preserved
-
page_menu:
- When you create multiple menus, the last one ends up on the top
- If you make multiple
page_menu
s, but the second one would overlap with the first one, making you unable to close the second one
-
page_navbar:
- If you call this multiple times, only the latest call would be the one implemented
- You can call the element anywhere inside
site.R
-
page_panel
(conditionally-singleton) :
- Right now, if you call a
page_panel
withposition=Left
argument and apage_menu
element, in first instance of rendering, the panel would first push the menu to the right of it, before having it recede to overlap it - This element is singleton by position (i.e., you cannot create two panels in the same position without it overlapping)
- Right now, if you call a
-
page_section:
- You can use this element to create any number of additional sections going down
-
page_tabgroup:
- If you follow the example, you realize that the
output_map()
is a singleton, and calling multiple maps, all but the first one appears
- If you follow the example, you realize that the
-
page_text:
- Adds html text to the site directly