rstudio / distill

Distill for R Markdown
https://rstudio.github.io/distill/
Apache License 2.0
422 stars 57 forks source link

social meta for non-posts (preview image for site) #294

Open shannonpileggi opened 3 years ago

shannonpileggi commented 3 years ago

Hi lovely distill developers! In this brief tweet exchange we noticed and discussed that when sharing distill websites (not specific blog posts) that the link renders on social media without a preview image. image

Would it be possible to jazz up the look on social media? Just a nice-to-have!

apreshill commented 3 years ago

Hi @shannonpileggi! I agree, looks like @jjallaire added this to the next version milestone.

I wonder if in the meantime metathis would work?

https://github.com/gadenbuie/metathis

shannonpileggi commented 3 years ago

Super, thanks for the quick reply and a possible solution! I am happy to wait for v1.3, whenever that may be. :)

HenrikBengtsson commented 3 years ago

I'm not 100% sure that this issue is the same as my feature request but I hope so. I want to be able to specify a default preview centrally in _site.yml, e.g.

preview: https://rstudio.github.io/distill/images/javascript-d3-preview.png

or alternatively also as:

base_url: https://rstudio.github.io/distill
preview: images/javascript-d3-preview.png

Is that what's proposed here?


BTW/FYI, right now I specify base_url in _site.yml and preview in the yaml header for each page. That get's me halfway there.
However, when doing this I end up with a /./ component in the URL, e.g.

<meta property="og:image" content="https://rstudio.github.io/distill/./images/javascript-d3-preview.png"/>

When specifying base_url in the yaml header, this doesn't happen, i.e.

<meta property="og:image" content="https://rstudio.github.io/distill/images/javascript-d3-preview.png"/>

This is with distill 1.2.