# Dynamic open graph and twitter images in meta tags of topic page when image is not present in topic

**URL:** <https://meta.discourse.org/t/dynamic-open-graph-and-twitter-images-in-meta-tags-of-topic-page-when-image-is-not-present-in-topic/65684>\
**Category:** Development\
**Created:** [2017 年7 月 5 日 19:16 UTC](https://meta.discourse.org/t/dynamic-open-graph-and-twitter-images-in-meta-tags-of-topic-page-when-image-is-not-present-in-topic/65684 "2017-07-05T19:16:07Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

作者： ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)\
发布日期： [2017 年7 月 6 日 14:54 UTC](https://meta.discourse.org/t/dynamic-open-graph-and-twitter-images-in-meta-tags-of-topic-page-when-image-is-not-present-in-topic/65684/3 "2017-07-06T14:54:03Z")

</div>

The serializer is a response in JSON format for an API call. It won’t be used when generating a page’s HTML.

Those tags are using the [TopicView](https://github.com/discourse/discourse/blob/master/lib/topic_view.rb) model, so you’ll have to extend it using `add_to_class` instead of `add_to_serializer`.

---

_[View the full topic](https://meta.discourse.org/t/dynamic-open-graph-and-twitter-images-in-meta-tags-of-topic-page-when-image-is-not-present-in-topic/65684)._
