Deploy Slides Online

TC edited this page Nov 13, 2018 · 3 revisions

Deploying Your Slides Online

I web, therefore I am a spiderman -yihui

Cool kids will dump their xaringan slides online and never bring a usb stick to their group meetings. Besides, when there exist free services like netlify and github pages, there's no reason not to do that.

Here is an example by Anna Kennedy

Here is a live example by TC

If you have problems during deploying your xaringan slides online, here are some tips that might be of help.


1. Importing fonts when hosting slides on Netlify

The @import rules for any imported fonts – for example from Google Fonts – need to be at the top of your CSS file. As shown in default-fonts.css below:

@import url(;
@import url(,700,400italic);
@import url(,700);

body { font-family: 'Droid Serif', 'Palatino Linotype', 'Book Antiqua', Palatino, 'Microsoft YaHei', 'Songti SC', serif; }

Netlify bundles multiple CSS files into a single file by default, which may break the @import rule and invalidate the font setting.


  • Order the CSS files in your YAML header in xaringan such that the fonts are imported first. For example: css: ["default-fonts", "default"].
  • Disable bundle and minify css in netlify.

See issue #141 for more details.

2. Fonts might be different after render locally and on web server

It can happens that same Rmd document rendered with same xaringan version will produce different fonts on local machine and remote server. The reason is likely to be external source of fonts, as can be observed in default-fonts.css.


Setting up web server with tool like servr is likely to solve issue on the side of your local machine. Another way is to use fonts that does need to be downloaded from external source.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.