seankross / postcards

💌 Create simple, beautiful personal websites and landing pages using only R Markdown.
Other
534 stars 78 forks source link

Add meta og tags #39

Open monkeywithacupcake opened 3 years ago

monkeywithacupcake commented 3 years ago

changes all templates in Pandoc (html) and skeleton (rmd) to allow for automatic meta/og tags without installing another package.

closes #32

relies on the already included title and image information.

Using this in the yaml:

meta:
  description: "data.coffee.run"
  url: "https://monkeywithacupcake.github.io"
  twitter: "jessachandler"

results in this in the html header:

 <meta name="description" content="data.coffee.run" />
      <meta name="twitter:description" content="data.coffee.run" />
      <meta name="og:description" content="data.coffee.run" />
      <meta name="twitter:title" content="Cheers!" />
      <meta name="og:title" content="Cheers!" />
      <meta name="twitter:url" content="https://monkeywithacupcake.github.io" />
      <meta property="og:url" content="https://monkeywithacupcake.github.io" />
      <meta name="twitter:image:src" content="https://monkeywithacupcake.github.io/jess.jpg" />
      <meta property="og:image" content="https://monkeywithacupcake.github.io/jess.jpg" />
      <meta name="twitter:card" content="summary" />
      <meta name="twitter:creator" content="@jessachandler" />
      <meta name="twitter:site" content="@jessachandler" />

and this twitter card:

Screen Shot of twitter card validator
hadley commented 2 years ago

This would be a good place to try a template partial: https://pandoc.org/MANUAL.html#partials