I am working on building a simple website through R markdown. And below is my _site.yml file:
name: "SampleWeb"
navbar:
title: "SampleWeb"
left:
- text: "Home"
href: index.html
- text: "Descriptive Analysis"
href: descriptive_analysis.html
- text: "Baseline GWAS Covariate-Sex"
href: gwas_baseline.html
My question is how to split the "Baseline GWAS Covariate-Sex" into two rows after build the website.
I tried "Baseline GWAS\nCovariate-Sex" and "Baseline GWAS
Covariate-Sex", but neither of these two approaches works. What should I try next? Any help is appreciated!
As you are dealing with HTML you have to use a <br>
tag to add a line break. However, simply adding a <br>
tag to the _site.yml
will not work as it gets escaped and hence rendered as text.
I haven't found an option to prevent that. But following R Markdown: The Definitve Guide one option to achieve your desired result would be to use a _navbar.html
file which allows for more control of the navbar.
# Modified from https://github.com/rstudio/rmarkdown-website/blob/master/_navbar.html
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<!-- NOTE: add "navbar-inverse" class for an alternate navbar background -->
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">SampleWeb</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="index.html">Home</a></li>
<li><a href="descriptive_analysis.html">Descriptive Analysis</a></li>
<li><a href="gwas_baseline.html">Baseline GWAS<br>Covariate-Sex</a></li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->