Some search engines do not use META DESCRIPTION and KEYWORDS anymore, but some still do I think, and who knows, maybe they still help your pages to be found on the internet.
So with friendly url mod in use i thought it might be a good idea to see if i could pull the album and image's descriptions and keywords and place them into the header of the page being viewed so that people's sites, images and pages could be found more easily when searching on the internet and what-not.
Go to global.tpl in the /gallery2/templates directory and place the following code between the <head> </head> tags as follows:
<head>
{* This should help out users whose browsers are confused about the character set *}
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
{* Content that G2 wants to display inside the <head> element *}
{g->head}
<meta name="description" content="{$layout.item.description|markup}">
</head>
I'm still looking for the $code which represents the keywords for the image/album so we can accomplish the following:
<meta name="keywords" content="{$gallerykeywordsforimage}">
anyone know what the $code for the keywords would be?
Posts: 32509
good call. could / should be done as module.
Posts: 30
yeah, good idea! anyone? ;-) i have no idea how to do a module!
Posts: 8601
here's a start:
http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=23200
and did you try $layout.item.keywords ?
Posts: 30
like a charm, thanks mindless! so there we have it:
<meta name="description" content="{$layout.item.description|markup}">
<meta name="keywords" content="{$layout.item.keywords}">
Posts: 8601
FYI, it's more appropriate to put this in a local layouts/matrix/templates/head.tpl because $layout.item won't exist on every G2 view, but will exist whenever head.tpl is used.
Posts: 30
ok.. well, my current matrix head.tpl only contains a <title> tag... should i just put the above code before this tag?
maybe my question should be: is the matrix/templates/head.tpl called into the head section so that whatever i put into head.tpl will be placed in the <head> section ?
err heheh i think i'm a little confused!
Posts: 8601
yes, head.tpl is included in the <head> section.. hence, the name..
Posts: 34
This didn't work for me when using G2, since my description had some BBCode markup. That made the description show up in the body of the browser. After some digging, here's the code I used to make this work with G2-RC2
<meta name="description" content="{$layout.item.description|markup:strip}">
<meta name="keywords" content="{$layout.item.keywords}">
This strips out all the HTML markup from the descriptions.
Posts: 47
This didn't work for me when using G2
<meta name="KEYWORDS" content="{$layout.item.keywords}" />
<meta name="DESCRIPTION" content="{$layout.item.description|markup:strip}" />
But, this is ok :D
<meta name="KEYWORDS" content="{$theme.item.keywords}" />
<meta name="DESCRIPTION" content="{$theme.item.description|markup:strip}" />
Posts: 17
Hi im using the seriux theme and i cant get my meta to show up in view source code:
I have the following code in (theme.tpl):
Can someone tell me whats the problem
Posts: 8601
do you see content="" or no <meta> tag at all? it looks fine, so maybe you put this in the wrong theme.tpl file. a URL would be helpful.
Posts: 17
I see no meta at all. Like it wasnt in the code. Strange... The site is localhost.