# Different schema type for Topics and Posts

**URL:** https://meta.discourse.org/t/different-schema-type-for-topics-and-posts/71471
**Category:** Feature
**Created:** [October 5, 2017, 3:02pm UTC](https://meta.discourse.org/t/different-schema-type-for-topics-and-posts/71471 "2017-10-05T15:02:58Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [October 5, 2017, 3:02pm UTC](https://meta.discourse.org/t/different-schema-type-for-topics-and-posts/71471/1 "2017-10-05T15:02:58Z")

</div>

Continuing the discussion from [Invalid Article Schema](https://meta.discourse.org/t/invalid-article-schema/57037/18):

Currently we are using schema type `DiscussionForumPosting` for every post in a topic. So if a topic having 5 posts totally then in same page we rendering `DiscussionForumPosting` 5 times.

In this case I think it’s better to use [`DiscussionForumPosting`](http://schema.org/DiscussionForumPosting) only once for whole topic and [`Comment`](http://schema.org/Comment) schema type for remaining 4 replies like below.

```plaintext
<div itemscope itemtype="http://schema.org/DiscussionForumPosting">

   <span itemprop="datePublished">10/05/2017</span>
	<span itemprop="headline">Sample Topic Title</span>
	<span itemprop="image">https://meta.discourse.org/image-url9.png</span>
	<div itemprop="articleBody">Topic's First Post Content</div>
    <span itemprop="author">User 1</span>
    
 	<div itemprop="comment" itemscope itemtype="http://schema.org/Comment">
    	<span itemprop="author">User 2</span>
    	<div itemprop="text">Second Post Content</div>
 	</div>
 
 	<div itemprop="comment" itemscope itemtype="http://schema.org/Comment">
    	<span itemprop="author">User 3</span>
    	<div itemprop="text">Third <b>Post</b> Content</div>
 	</div>
 
</div>

```

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [October 5, 2017, 11:12pm UTC](https://meta.discourse.org/t/different-schema-type-for-topics-and-posts/71471/2 "2017-10-05T23:12:53Z")

</div>

Why? What problem does this solve?

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [October 6, 2017, 6:58am UTC](https://meta.discourse.org/t/different-schema-type-for-topics-and-posts/71471/3 "2017-10-06T06:58:01Z")

</div>

It won’t solve any big issue 🙂

> [@Topic Ratings Plugin](https://meta.discourse.org/t/topic-ratings-plugin/39578/111):
>
> @vinothkannans You probably are already aware that Google’s structured data testing tool is complaining about the DiscussionForumPosting microdata for core Discourse topic views not having images.

Since we are using `DiscussionForumPosting` schema for every post Google requiring valid `image` property for all posts. If we used `DiscussionForumPosting` only once for topic then we can skip this issue. And I guess this is the correct way to do.

---

<div class="post-metadata">

### Author: ![PoojaPatel](https://avatars.discourse-cdn.com/v4/letter/p/edb3f5/32.png) [@PoojaPatel](https://meta.discourse.org/u/PoojaPatel)
#### Post date: [February 8, 2019, 5:10am UTC](https://meta.discourse.org/t/different-schema-type-for-topics-and-posts/71471/4 "2019-02-08T05:10:46Z")

</div>

Currently i have not seen above schema method in discourse.

Is this method are in work in progress?

I have found one image error in schema testing tool as below.

 ![Google%20Structured%20Data%20Snapshot](https://global.discourse-cdn.com/meta/original/3X/3/1/31f4a2c7a030a5315b479afdd88cc88be0f31839.png)

Also, I want to hide “datePublished” items from google serp. Can anyone guide me how to do that?

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [February 8, 2019, 5:24am UTC](https://meta.discourse.org/t/different-schema-type-for-topics-and-posts/71471/5 "2019-02-08T05:24:27Z")

</div>

> [@PoojaPatel](#):
>
> Is this method are in work in progress?

No. Currently I am not sure about this change 100%. I’m unable to find any resource that recommending `Comment` schema type for reply posts.

> [@PoojaPatel](#):
>
> I want to hide “datePublished”

Not error. It is just a warning. Google recommending the image field **if available**.

> [@PoojaPatel](#):
>
> I have found one image error in schema testing tool

It is a required field.

---

<div class="post-metadata">

### Author: ![PoojaPatel](https://avatars.discourse-cdn.com/v4/letter/p/edb3f5/32.png) [@PoojaPatel](https://meta.discourse.org/u/PoojaPatel)
#### Post date: [February 8, 2019, 6:05am UTC](https://meta.discourse.org/t/different-schema-type-for-topics-and-posts/71471/6 "2019-02-08T06:05:47Z")

</div>

I am looking to hide published date shown from google search only.

I search “Different schema type for Topics and Posts” on google and found below post.

![Discourse%20Date%20Snapshot%202](https://global.discourse-cdn.com/meta/original/3X/0/4/0405aad8d3cee09ac621bbaeac332f5b2efae0c6.png)

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [February 8, 2019, 7:12am UTC](https://meta.discourse.org/t/different-schema-type-for-topics-and-posts/71471/7 "2019-02-08T07:12:05Z")

</div>

It is not recommended. You have to override the [show.html.erb](https://github.com/discourse/discourse/blob/3d52f690b3e4241d0a46f1fb1941c5da3ca27c8d/app/views/topics/show.html.erb) template file with a plugin to achieve it.

---

<div class="post-metadata">

### Author: ![PoojaPatel](https://avatars.discourse-cdn.com/v4/letter/p/edb3f5/32.png) [@PoojaPatel](https://meta.discourse.org/u/PoojaPatel)
#### Post date: [February 9, 2019, 12:55pm UTC](https://meta.discourse.org/t/different-schema-type-for-topics-and-posts/71471/8 "2019-02-09T12:55:48Z")

</div>

When search “Change the domain name or rename my Discourse?” found the below article but shows the date in google serp search that when article was published 1st time in 2014.

After that there are 7 revision made on that post and last updated date in 09th December 2017.

So is there anyway to set in forum or made any changes for google to pickup “last update date” instead of “date published” ?

 ![Google%20Structured%20Data%20Snapshot%202](https://global.discourse-cdn.com/meta/original/3X/b/d/bd59de775256469dd0d8c3455299e444324cbfa5.png)

I hope everyone understand my doubt. If anyone show tutorial post on google search result but that are showing 4 years backdated then there are less chances to click.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [February 10, 2019, 1:53am UTC](https://meta.discourse.org/t/different-schema-type-for-topics-and-posts/71471/9 "2019-02-10T01:53:51Z")

</div>

Ah yes, excellent point, we should check the HTML metadata there @vinothkannans to make sure for **wiki posts** it is using date of last edit and not date of initial posting.

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [February 11, 2019, 11:29am UTC](https://meta.discourse.org/t/different-schema-type-for-topics-and-posts/71471/11 "2019-02-11T11:29:28Z")

</div>

We previously only used `created_at` date in `datePublished` schema property. Now if a post is updated then the `updated_at` date will used in `dateModified` schema property along with existing `datePublished` property. I did it for all the posts. Since we now including both the dates it won’t be a issue. Google search already [respecting the both](https://developers.google.com/search/docs/data-types/article#article_types).

[https://github.com/discourse/discourse/commit/2c12336c6b7c8223d4fa00b2e928e276224f05a5](https://github.com/discourse/discourse/commit/2c12336c6b7c8223d4fa00b2e928e276224f05a5)

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [February 20, 2021, 10:10am UTC](https://meta.discourse.org/t/different-schema-type-for-topics-and-posts/71471/14 "2021-02-20T10:10:59Z")

</div>

> [@vinothkannans](#):
>
> I think it’s better to use [`DiscussionForumPosting`](http://schema.org/DiscussionForumPosting) only once for whole topic and [`Comment`](http://schema.org/Comment) schema type for remaining 4 replies like below.

#pr-welcome tag added

---

<div class="post-metadata">

### Author: ![rrlevering](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rrlevering/32/290917_2.png) [@rrlevering](https://meta.discourse.org/u/rrlevering)
#### Post date: [March 17, 2023, 3:41pm UTC](https://meta.discourse.org/t/different-schema-type-for-topics-and-posts/71471/16 "2023-03-17T15:41:06Z")

</div>

I know this is a super stale thread, but I just wanted to voice my support for this approach. I’ll follow up with more official channels/recommendations in the future but I wanted to just ping here because it was your own idea.

My name is Ryan Levering and I handle structured data ingestion at Google ([this guy](https://www.youtube.com/watch?v=hUHjeDylhE8)). Discourse is sort of a snowflake in that it’s one of the only forum engines that uses DFPs at the root level for each comment in the thread. This makes it harder for us to figure out the type of the page AND to authoritatively detect the main post on the page.

We’re going to be recommending everyone use DiscussionForumPosting for the OP and then attach the rest of the responses to the original post as [comment - Schema.org Property](http://schema.org/comment), exactly like recommended in the OP here. Other markup would be good as well (like more user interaction stats for instance), but that restructuring would go a long way toward making it easier to include Discourse forums in our features.

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [March 27, 2023, 10:13pm UTC](https://meta.discourse.org/t/different-schema-type-for-topics-and-posts/71471/20 "2023-03-27T22:13:04Z")

</div>

Hi Ryan,

Thanks for letting us know. We will do the required changes as soon as possible.

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [April 3, 2023, 8:25am UTC](https://meta.discourse.org/t/different-schema-type-for-topics-and-posts/71471/21 "2023-04-03T08:25:07Z")

</div>

[https://github.com/discourse/discourse/pull/20932](https://github.com/discourse/discourse/pull/20932)

This PR will implement the behavior recommended [above](https://meta.discourse.org/t/different-schema-type-for-topics-and-posts/71471/16).

---

<div class="post-metadata">

### Author: ![j127](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j127/32/79093_2.png) [@j127](https://meta.discourse.org/u/j127)
#### Post date: [April 3, 2023, 7:36pm UTC](https://meta.discourse.org/t/different-schema-type-for-topics-and-posts/71471/22 "2023-04-03T19:36:39Z")

</div>

> [@rrlevering](#):
>
> This makes it harder for us to figure out the type of the page AND to authoritatively detect the main post on the page.

I’m not sure how much this is related to what you’re doing, but Google is having trouble with detecting posts/topics on my site. The canonical URLs might have some effect on how you determine the exact main post on the page.

I just got a Google Alert that a post URL like this is indexed:

- `https://forum.example.com/t/the-slug/123/16`

Google Search Console confirms that the exact URL is indexed on “on Google”.

But the canonical URL that Google fetched is different:

```plaintext
<link rel="canonical" href="https://forum.example.com/t/the-slug/123" />

```

With the way Discourse is set up at the moment, those post URLs shouldn’t be indexed because the canonical URLs all point to the topic.

If you want to see those kinds of URLs getting indexed, set a Google Alert for something like `site:meta.discourse.org` and “all results as they happen”.

---

<div class="post-metadata">

### Author: ![rrlevering](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rrlevering/32/290917_2.png) [@rrlevering](https://meta.discourse.org/u/rrlevering)
#### Post date: [April 6, 2023, 5:27pm UTC](https://meta.discourse.org/t/different-schema-type-for-topics-and-posts/71471/23 "2023-04-06T17:27:53Z")

</div>

I am no canonicalization expert, so I shouldn’t say something that is wrong here. But I’m pretty sure it’s unrelated. Markup is not used at all in canonicalization as far as I know. And while I guess it could be possible to confuse systems by having a non-canonical URL have some markup that said mainEntityOfPage: \<canonical-url\> (so it looked like the markup was asserting that it was the main post from a different page), I haven’t seen that come up yet.

While we’re on the subject though, Discourse currently asserts that every comment/non-first-post is the mainEntityOfPage: \<url\>. I believe that will be true after the fix change as well. This also confuses the detection (and means we have to drop that assertion altogether). I think that with the fix it’ll give us enough signal to prevent problems now, but it’s probably better to only use that on the first post.

---

<div class="post-metadata">

### Author: ![rrit](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@rrit](https://meta.discourse.org/u/rrit)
#### Post date: [January 1, 2024, 8:01pm UTC](https://meta.discourse.org/t/different-schema-type-for-topics-and-posts/71471/24 "2024-01-01T20:01:09Z")

</div>

> [@rrlevering](#):
>
> […] Discourse currently asserts that every comment/non-first-post is the mainEntityOfPage: . I believe that will be true after the fix change as well. This also confuses the detection (and means we have to drop that assertion altogether). I think that with the fix it’ll give us enough signal to prevent problems now, but it’s probably better to only use that on the first post.

This is in process of being addressed now:  
[https://github.com/discourse/discourse/pull/25043](https://github.com/discourse/discourse/pull/25043)  
[https://github.com/discourse/discourse/pull/25082](https://github.com/discourse/discourse/pull/25082)

@rrlevering If you have time to spare, I would really appreciate some feedback on this:

- [Google structured data for forums and profile pages - #9 by rrit](https://meta.discourse.org/t/google-structured-data-for-forums-and-profile-pages/286762/9) (closed)
- [Discussion Forum Schema improvements - #19 by techAPJ](https://meta.discourse.org/t/discussion-forum-schema-improvements/287347/19) (ongoing)
