We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

One master layout template, injecting metadata depending on channel

How Do I?

iameric's avatar
iameric
48 posts
7 years ago
iameric's avatar iameric

Hi Folks.

I am trying to sort an issue where I need to add Facebook and Twitter card meta tags depending on channel and page loaded.

Generally for the whole site I have a single master layout file and a main template file for each channel since the info varies greatly enough that one template or layout file for ALL channels just won’t work without a crazy amount of conditionals.

The main layout file is mostly general stuff - declaration, head, body tag, closing scripts (attaching jquery etc). Within the head I include a conditional to load FB and TW metadata if there is a layout:variable present in the loaded channel’s main template.

The FB and Twitter metadata is contained in a partial to load items like description, title etc depending on the loaded page. So this partial includes it’s own set of Channel Entry tags in order to pull in the correct data from the loaded page.

So everything works fine, but I am wondering if I am over-complicating it. My fear here at the moment is to bog down loading time. Does anyone have any thoughts on that?

Thanks!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.