RealFaviconGenerator / gulp-real-favicon

Gulp plugin to generate a multiplatform favicon with RealFaviconGenerator
76 stars 6 forks source link

og:image meta tag is being stripped from HTML #8

Closed dak closed 8 years ago

dak commented 8 years ago

If a different image is being used for og:image and it is already defined in HTML that is parsed by injectFaviconMarkups, the tag is removed (even if there is no replacement tag).

twitter:image is not being removed.

OpenGraph images tend to be something different than a site's favicon, as they are quite larger, and use a different aspect ratio. RealFavicon should be respecting pre-existing tags.

dak commented 8 years ago

This is a duplicate: https://github.com/RealFaviconGenerator/rfg-api/issues/4

tadwohlrapp commented 4 years ago

For anyone having the same issue, as I did after adding open graph tags to an old project:

const realFaviconOptions = {
  keep: 'meta[property="og:image"]'
};

function favicons() {
  return gulp.src(paths.html.src)
    .pipe(realFavicon.injectFaviconMarkups(
      JSON.parse(fs.readFileSync(FAVICON_DATA_FILE)).favicon.html_code,
      realFaviconOptions))
    .pipe(gulp.dest(paths.html.dest));
}