The include and exclude fields enable you to override the default behavior vis-à-vis what files are copied into the output directory. Note that this can be “.” to keep all content within the root website directory alongside the source code. The output_dir field indicates which directory to copy site content into (“_site” is the default if none is specified). The name field provides a suggested URL path for your website when it is published (by default this is just the name of the directory containing the site). Name : "my-website" output_dir : "_site" include : exclude : To build a website from the command line, use the rmarkdown::render_site() function: The HTML files within the _site directory are now ready to deploy as a standalone static website. The generated HTML files and any supporting files (e.g. CSS and JavaScript) are copied into an output directory ( _site by default). Note however that markdown files beginning with “_” are not rendered (this is a convention to designate files that are included by top level documents).īlog posts will be copied into the posts sub-directory of the output directory and blog listing pages will be re-generated. When you build a website, the following things occur:Īll of the Rmd and md files in the root website directory will be rendered into HTML. If your Distill website is contained within an RStudio project, you can use the Build Website command available in the Build pane to generate the site: Building the siteĪfter you’ve authored the various articles contained within the website, you will want to build the entire site before deploying it. This is our recommended workflow for authoring articles since it offers the fastest turnaround time for previews (since only the article you are working on is rendered). This will build only the specified article (as opposed to all articles in the site). Why? Given that R package upgrades have a tendency to break older code, continuously re-rendering old posts is nearly impossible to do without errors, especially over longer periods of time. Each blog article has to be rendered on its own, with intent. ![]() Workflow difference: Furthermore, website pages and root pages of blogs are re-rendered when the site is rebuilt but blog articles are not. When you knit and publish a new post, this page automatically updates by adding the most recent post to the top of the list. Whereas websites require you to manually set up links to pages, a listing page collects links to posts for you, displaying key metadata (like date published, author, categories, title, etc.) and a thumbnail image. Layout difference: Within a blog, Distill enables a special page on your website called a listing page. Distill blogs are a distill website with added blog posts. Structure difference: Websites are just collections of pages you can navigate to via the top navigation bar, whereas blogs have collections of posts that can be indexed and syndicated (via their RSS feed). ![]() Once you’ve created your website locally, there are a variety of ways available to publish your site to the web. You can view more examples of Distill websites on the package reference site. For example, the documentation pages you are reading now are a Distill website. Distill websites include a top level navigation bar that enables readers to discover and browse articles. This article describes how to create a website that contains a collection of Distill articles.
0 Comments
Leave a Reply. |