Sitebee_uk
Member
I'm fairly new to modifying and theme customisation for Xenforo. I'm looking to create a snippets file house house all my theme customisations. If you're familiar with Shopify, Shopify has a snippets section that you can house all your theme mods, etc.
I'm looking to achieve something similar with Xenforo.
For example, I've made some page_container tweaks to the HEAD such as titles, descriptions & schema. If I keep continuing to apply theme mods to page_container it will start to become very cluttered. What I want to be able todo, it write those modifactions in a seperate file and call it in the page_container file. Any tips on how I can achieve this?
Examples:
I'm writing custom page titles and meta descriptions. If I continue down this page the page_container with become very cluttered indeed.
Structured data, which I plan to implement based on page types, breadcrumb depth, etc.
I'm not really looking to achieve this by utilising addons, looking todo this manually.
Thanks for reading.
I'm looking to achieve something similar with Xenforo.
For example, I've made some page_container tweaks to the HEAD such as titles, descriptions & schema. If I keep continuing to apply theme mods to page_container it will start to become very cluttered. What I want to be able todo, it write those modifactions in a seperate file and call it in the page_container file. Any tips on how I can achieve this?
Examples:
I'm writing custom page titles and meta descriptions. If I continue down this page the page_container with become very cluttered indeed.
Code:
<!-- page title & description modifications -->
<!-- page title -->
<xf:if is="$containerKey == 'node-10'">
<title>Node custom page title goes here</title>
<xf:else />
<title><xf:title formatter="%s | %s" fallback="{$xf.options.boardTitle}" page="{$pageNumber}" /></title>
</xf:if>
<!-- meta description -->
<xf:if is="$containerKey == 'node-10'">
<meta name="description" content="Node custom meta description goes here"/>
<xf:else />
<meta name="description" content="{$description}"/>
</xf:if>
Structured data, which I plan to implement based on page types, breadcrumb depth, etc.
Code:
<!-- structured data -->
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "BreadcrumbList",
"itemListElement": [{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "{{ link('canonical:index')|escape('js') }}"
},{
"@type": "ListItem",
"position": 2,
"name": "{$h1}",
"item": "{$xf.fullUri}"
}]
}
</script>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebPage",
"name": "{$h1}",
"description": "{$description}",
"publisher": {
"@type": "WebPage",
"name": "{$xf.options.boardTitle}"
}
}
</script>
I'm not really looking to achieve this by utilising addons, looking todo this manually.
Thanks for reading.