Working on a new R Markdown template for the hrbrthemes
package.
I want to bake-in support for Open Graph & Twitter meta tags with something like this (I'm not fully settled on the hierarchy but that doesn't really matter for this q):
---
title: "The Ipsum R Markdown Experience"
ipsum_meta:
twitter_card: "Summary info for the Twitter Card"
twitter_site: "@sitehandle"
twitter_creator: "@creatorhandle"
og_url: "https://example.com/open/graph/finalURLfor/this"
og_description: "A modest size description of the content"
og_image: "https://example.com/open/graph/imageURLfor/this"
output:
hrbrthemes::ipsum:
toc: true
---
on the custom HTML template site I'm trying to do:
$if(ipsum_meta)$
$if(ipsum_meta.twitter_card)$<meta name="twitter:card" content="$ipsum_meta.twitter_card$" />$endif$
$if(ipsum_meta.twitter_site)$<meta name="twitter:site" content="$ipsum_meta.twitter_site$" />$endif$
$if(ipsum_meta.twitter_creator)$<meta name="twitter:creator" content="$ipsum_meta.twitter_creator$" />$endif$
$if(ipsum_meta.og_url)$<meta property="og:url" content="$ipsum_meta.og_url$" />$endif$
$if(title)$<meta property="og:title" content="$ipsum_meta.title$" />$endif$
$if(ipsum_meta.og_description)$<meta property="og:description" content="$ipsum_meta.og_description$" />$endif$
$if(ipsum_meta.og_image)$<meta property="og:image" content="$ipsum_meta.og_image$" />$endif$
$endif$
but the @-bits and URLs end up looking like:
<meta name="twitter:card" content="Summary info for the Twitter Card" />
<meta name="twitter:site" content="<span class=" citation" data-cites="sitehandle">@sitehandle</span>" />
<meta name="twitter:creator" content="<span class=" citation" data-cites="creatorhandle">@creatorhandle</span>" />
<meta property="og:url" content="<a href=" https: example.com open graph finalURLfor this" class="uri">https://example.com/open/graph/finalURLfor/this</a>" />
<meta property="og:title" content />
<meta property="og:description" content="A modest size description of the content" />
<meta property="og:image" content="<a href=" https: example.com open graph imageURLfor this" class="uri">https://example.com/open/graph/imageURLfor/this</a>" />
and I just really need a pointer to the magic spells that tell the various components in the pass-down process to not process those strings. Google and SO have been no real help but I cld also be not searching well.
I shld note that what I'm ultimately trying to avoid is folks having to do:
---
title: "The Ipsum R Markdown Experience"
ipsum_meta:
twitter_card: "Summary info for the Twitter Card"
twitter_site: "\\@sitehandle"
twitter_creator: "\\@creatorhandle"
og_url: "https\\://example.com/open/graph/finalURLfor/this"
og_description: "A modest size description of the content"
og_image: "https\\://example.com/open/graph/imageURLfor/this"
output:
hrbrthemes::ipsum:
toc: true
---
That works and leads me to believe that this is some pandoc PreEscape
-ing vs rmarkdown
pre-processing, but I'm just seeing if others ran into this.