Simply add your own entries to the XenForo header.

Simply add your own entries to the XenForo header.

Masetrix

Well-known member
Masetrix submitted a new resource:

Simply add your own entries to the XenForo header. - Simply add your own entries to the XenForo header. Upgrade security even if XF upgrades replace temp

Log into the Xenforo admin panel....
Follow this link: /admin.php?template-modifications/&type=public

Click on:

View attachment 234205

Enter these or your own values and choose the template page_container.

View attachment 234206

Insert the following data....
View attachment 234207

and insert the following data at "Replace" ....

In this example we add <meta name="theme-color" content = "#185886" />
However, other entries (meta description and so...

Read more about this resource...
 
Two years in and I still haven't noticed this function (nor have I noticed the unfurl tester that Chris pointed out—this is much bigger than I thought).

I usually just modify, in this case, PAGE_CONTAINER and it makes merging updates a mess. Would this make merging, pretty much irrelevant, and I would just need to find/replace the code it was modified from to change it to a new template mod then? 🤔

It looks much easier doing it this way as I could keep track of mods without using <xf:comment> in the dozens of templates that I did modify already.

One question, though... does editing it this way slow it down (I know, it might be minute, unless a 'big board') or is it comparable to a direct template edit?
 
@Masetrix this functionality is usually only available if development mode is enabled - it's primarily a development tool and we don't generally recommend it as a general purpose tool.

So most people won't be able to follow your instructions.

But I noticed some interesting differences. First, I don't actually think you have development mode enabled, I think this functionality is just available to you. It also seems as though you have a "Style" selector on the template modification pages. Template modifications are always applied to the master style, and not per-style.

Do you have an add-on which enables this functionality more generally, if so, you may need to mention that in your guide.

Additionally, this is not recommended:

1599211928632.png


Note the text: You may use $0 to insert the found text.

With that in mind, your replacement could be simplified to:

HTML:
$0
<meta name="theme-color" content="#185886" />

In fact, your entire "Find" field could be simplified to:

HTML:
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">

Or even:

HTML:
viewport-fit=cover">

Always use the minimum possible text in your find string. All you have to do is make sure the bit that you "find" only appears once, otherwise it may be replaced multiple times.

Finally, and most crucially, your example is extremely flawed.

XenForo already adds the theme-color meta tag:

HTML:
<xf:if is="property('metaThemeColor')">
   <meta name="theme-color" content="{{ parse_less_color(property('metaThemeColor')) }}" />
</xf:if>

You just have to set the metaThemeColor style property to whatever colour you want.
 
Would this be recommended with 50+ style edits on different templates on the default theme or to stick to individual edits and then try to merge them; and if they don't merge, go back and figure out how you can achieve them, @Chris D?
 
It's a developer tool. It's basically not aimed towards admins making style changes. Take from that what you will.
 
  • Like
Reactions: frm
Back
Top Bottom