Replacing Global Metadata with extra page attributes

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
pmckeown
Forum Members
Forum Members
Posts: 13
Joined: Thu Jul 27, 2006 3:40 pm

Replacing Global Metadata with extra page attributes

Post by pmckeown »

Hi,

I am using extra page attribute 1 for the meta description and extra page attribute 2 for the meta keywords

Is there an [if} statement I can use to display the Global Meta Data only if the extra page attributes 1&2 are left empty.

At the moment the meta tags are appreaing twice.
Regards
Pat
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Replacing Global Metadata with extra page attributes

Post by Rolf »

- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
kermit
Power Poster
Power Poster
Posts: 693
Joined: Thu Jan 26, 2006 11:46 am

Re: Replacing Global Metadata with extra page attributes

Post by kermit »

in site admin -> global settings -> general settings -> global metadata, try:

Code: Select all

<meta name="keywords" content="{capture assign=e2}{page_attr key="extra2"}{/capture}{if $e2 neq ''}{page_attr key="extra2"}{else}default,keywords,here{/if}" />
<meta name="description" content="{capture assign=e1}{page_attr key="extra1"}{/capture}{if $e1 neq ''}{page_attr key="extra1"}{else}default description{/if}" />
_____

what i did was a little different. i removed those two lines (meta keywords, meta description) from global metadata and inserted them in page default metadata instead, modified as follows:

Code: Select all

<meta name="keywords" content="{global_content name='meta-keywords'}" />
<meta name="description" content="{global_content name='meta-description'}" />
those two global content blocks contain site-wide defaults. then in page edit mode, i just add page-specific data before the gcb, like this:

Code: Select all

<meta name="keywords" content="this, page, keywords, here, {global_content name='meta-keywords'}" />
<meta name="description" content="this page specific description. {global_content name='meta-description'}" />
i could also just change the gcb called and have several already made-up for various pages or areas of a site.
Last edited by kermit on Fri Jun 11, 2010 1:27 pm, edited 1 time in total.
eternity (n); 1. infinite time, 2. a seemingly long or endless time, 3. the length of time it takes a frozen pizza to cook when you're starving.
4,930,000,000 (n); 1. a very large number, 2. the approximate world population in 1986 when Microsoft Corp issued its IPO. 3. Microsoft's net profit (USD) for the quarter (3 months) ending 31 March 2007.
CMSMS migration and setup services | Hosting with CMSMS installed and ready to go | PM me for Info
pmckeown
Forum Members
Forum Members
Posts: 13
Joined: Thu Jul 27, 2006 3:40 pm

Re: Replacing Global Metadata with extra page attributes

Post by pmckeown »

Hi

Thanks for the assistance - very helpful

Regards Pat
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Replacing Global Metadata with extra page attributes

Post by Rolf »

Hi pmckeown,

If your question is answered here, would you please be so kind and put [solved] in the title of the first post? You can use the modify button for this.

Have fun, Rolf  :)
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
kermit
Power Poster
Power Poster
Posts: 693
Joined: Thu Jan 26, 2006 11:46 am

Re: Replacing Global Metadata with extra page attributes

Post by kermit »

i was looking at doing the same thing, using per-page extra attribute for meta tags such as 'description', but the field length (255) is too short for some implementations.
Last edited by kermit on Sun Jul 04, 2010 9:24 pm, edited 1 time in total.
eternity (n); 1. infinite time, 2. a seemingly long or endless time, 3. the length of time it takes a frozen pizza to cook when you're starving.
4,930,000,000 (n); 1. a very large number, 2. the approximate world population in 1986 when Microsoft Corp issued its IPO. 3. Microsoft's net profit (USD) for the quarter (3 months) ending 31 March 2007.
CMSMS migration and setup services | Hosting with CMSMS installed and ready to go | PM me for Info
beherenow_uk
Forum Members
Forum Members
Posts: 103
Joined: Fri Nov 28, 2008 11:26 am

Re: Replacing Global Metadata with extra page attributes

Post by beherenow_uk »

Hi Kermit,

Im not sure if this is seen as 'editing a core file' or not, but we also had the same issue for wanting to extend the extra attribute field length...

So I edited the file /lib/classes/class.content.inc.php on line 2085, 2091, 2097 and changed the maxlength="255" bit to maxlength="600".

Our SEO guy is a very happy man now.

kind regards,

Karl.

Ps - if this is seen by the admins as hacking a core file, please could you let me know. Im not sure what constitutes a 'core file' as I'm new here :)
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Replacing Global Metadata with extra page attributes

Post by Rolf »

beherenow_uk wrote: Ps - if this is seen by the admins as hacking a core file, please could you let me know. Im not sure what constitutes a 'core file' as I'm new here :)
Yep, this is hacking the core files... Not serious, but... there are alternatives
And these changed files are overwritten when doing a upgrade!

A better solution in my reply posted above:
http://forum.cmsmadesimple.org/index.ph ... #msg212993
It uses the {content} tag.
Same flexibility, but you don't need to change core files anymore.

Hope this helps

Rolf  :)
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
beherenow_uk
Forum Members
Forum Members
Posts: 103
Joined: Fri Nov 28, 2008 11:26 am

Re: Replacing Global Metadata with extra page attributes

Post by beherenow_uk »

Ahh... I see,

Thanks Rolf, that is a much better solution.

best,

Karl.
Post Reply

Return to “CMSMS Core”