Add data-content-key values to all content types

Brogan

XenForo moderator
Staff member
Currently only threads have a value passed into them for the data-content-key as can be seen here:
HTML:
<html id="XF" lang="en-US" dir="LTR" data-app="public" data-template="thread_view_type_article"
data-container-key="node-3" data-content-key="thread-183723" data-logged-in="true" data-cookie-prefix="xf_"
data-csrf="1608463565,5abdc18feb78a481c104f8f6083"
class="has-js template-thread_view_type_article has-no-touchevents has-passiveeventlisteners has-no-hiddenscroll has-os-windows has-browser-chrome has-pointer-nav">

That allows you to do stuff like this:


Other content types such as specific resouces, media gallery items, and even members, don't have a value, so can't be targeted in the same way.
This is a resource for example:
HTML:
<html id="XF" lang="en-US" dir="LTR" data-app="public" data-template="xfrm_resource_view"
data-container-key="xfrmCategory-43" data-content-key="" data-logged-in="true" data-cookie-prefix="xf_"
data-csrf="1608158519,c92fa69280d893aea7dca9ffd5"
class="has-js template-xfrm_resource_view has-no-touchevents has-passiveeventlisteners has-no-hiddenscroll has-os-windows has-browser-chrome has-pointer-nav">

Passing a value in for the content key, e.g. data-content-key="resource-8197" would open up many possibilities related to notices and other tailored content.
 
Upvote 6
Top