Content: [@nuxt/content-theme-docs] generate social preview image

Created on 12 Aug 2020  路  3Comments  路  Source: nuxt/content

Is your feature request related to a problem? Please describe.

Related to #371, instead of manually generating a social preview image, we may use an automated way to generate it.

Describe the solution you'd like

I would suggest having a built-in SVG template (so contents like texts and colors are replaceable on build time) and using svg2img to generate png format. (alternatively, we may use sharp). We can also directly use SVG for doc itself.

Describe alternatives you've considered

An alternative method as suggested by @danielroe would be providing a lambda function using a headless browser but it would add a service dependency which is in contrast to going full-static and being independent of APIs.

Additional context

Maybe we can finally refactor this solution out of nuxt/content for an easy way to generate social preview for static target :)

enhancement

Most helpful comment

@danielroe Headless browser could be good just it has a downside of ~300MB install size (vs svg2img: 120MB | sharp: 39MB) and requires chrome dependencies to be installed in CI/CD pipeline.
Benefit of headless browser would be it allows using vue components to design vs SVG to be designed once but at least for teme-docs where we have everything else predesigned probably not much benefit.

All 3 comments

A Nuxt module that uses a headless browser could also be done at generate time, for fully static.

@danielroe Headless browser could be good just it has a downside of ~300MB install size (vs svg2img: 120MB | sharp: 39MB) and requires chrome dependencies to be installed in CI/CD pipeline.
Benefit of headless browser would be it allows using vue components to design vs SVG to be designed once but at least for teme-docs where we have everything else predesigned probably not much benefit.

I love it 馃挴

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rodrigocvb picture rodrigocvb  路  3Comments

Rednas83 picture Rednas83  路  3Comments

LukaszRados picture LukaszRados  路  3Comments

jhull picture jhull  路  4Comments

haykokalipsis picture haykokalipsis  路  4Comments