if ($CURRENT_PIC_DATA['keywords']) { $meta_keywords = "<meta name=\"keywords\" content=\"".$CURRENT_PIC_DATA['keywords']."\"/>"; }
<title>Gryz.pl - Gry online. Nie do przegryzienia. - Często zadawane pytania</title>
pageheader($lang_faq_php['faq']);
and replace with$meta_description = '<meta name="Description" content="Często zadawane pytania on our gaming site" />';
pageheader($lang_faq_php['faq'], $meta_description );
Simple as that.
pageheader(isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album]);
$meta_description = '<meta name="Description" content="'.$CURRENT_ALBUM_DATA['title'].' on our gaming site" />';
pageheader(isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album], $meta_description);
$meta_description = '<meta name="Description" content="'.$CURRENT_ALBUM_DATA['title'].' on our gaming site" />';
pageheader(isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album], $meta_description);
$meta_keywords .= $meta_nav;
$meta_description = '<meta name="Description" content="Game '.$picture_title.' on our gaming site.Play in '.$picture_title.' or another game in category '.$CURRENT_ALBUM_DATA['title'].'. Another static text goes here." />';
pageheader($album_name . '/' . $picture_title, $meta_description, false);
Why don't you just try and give us feedback?Can't see why above mentioned modifications should not work when Coppermine is being bridged with Joomla (or any other app). Bridging doesn't deal with visual integration anyway. However, we have no idea about Joomla and how it works. As suggested: find it out and report back. If it doesn't work as expected, undo your changes and that's it. I can't see the point in asking "will this work with XXX?".
we have no idea about Joomla and how it works.
?>
// DEFAULT META DESCRIPTION TEXT
$CONFIG['meta_description'] = 'Your site default meta description text';
if ($CURRENT_PIC_DATA['keywords']) { $meta_keywords = "<meta name=\"keywords\" content=\"".$CURRENT_PIC_DATA['keywords']."\"/>"; }
$meta_description = empty($CURRENT_PIC_DATA['caption']) ? $CONFIG['meta_description'] : strip_tags(bb_decode($CURRENT_PIC_DATA['caption']));
$desc_len = strlen($meta_description);
if (!is_numeric($album)) $desc_len += strlen($album_name)+3;
if ($desc_len > 200) {
$offset = 170;
if (!is_numeric($album)) $offset -= strlen($album_name)+3;
$meta_description = substr($meta_description, 0, strpos($meta_description, " ", $offset))."...";
}
if (!is_numeric($album)) $meta_description .= " - " . $album_name;
$meta_description = "\n<meta name=\"description\" content=\"$meta_description\" />\n";
$meta_keywords .= $meta_description;
if (isset($cat)) {
$meta_description = $CONFIG['meta_description'];
get_meta_album_set($cat,$META_ALBUM_SET);
$result = cpg_db_query("SELECT description FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid = '$cat'");
if (mysql_num_rows($result) > 0) list($cat_desc) = mysql_fetch_array($result);
if (!empty($cat_desc)) {
$meta_description = strip_tags(bb_decode($cat_desc));
} else if ($cat >= FIRST_USER_CAT) {
$user_name = get_username($cat - FIRST_USER_CAT);
if (!$user_name) $user_name = 'Mr. X';
$meta_description = sprintf($lang_list_categories['xx_s_gallery'], $user_name);
}
mysql_free_result($result);
pageheader($BREADCRUMB_TEXT ? $BREADCRUMB_TEXT : $lang_index_php['welcome']);
$desc_len = strlen($meta_description);
if (isset($_GET['cat']) && $PAGE > 1) $desc_len += strlen($lang_index_php['page'] . " $PAGE")+3;
if ($desc_len > 200) {
$offset = 170;
if (isset($_GET['cat']) && $PAGE > 1) $offset -= strlen($lang_index_php['page'] . " $PAGE")+3;
$meta_description = substr($meta_description, 0, strpos($meta_description, " ", $offset))."...";
}
if (isset($_GET['cat']) && $PAGE > 1) $meta_description .= " - " . $lang_index_php['page'] . " $PAGE";
$meta_description = "<meta name=\"description\" content=\"$meta_description\" />\n";
$page_title = ($BREADCRUMB_TEXT) ? $BREADCRUMB_TEXT : $lang_index_php['welcome'];
if (isset($_GET['cat']) && $PAGE > 1) $page_title .= " - " . $lang_index_php['page'] . " $PAGE";
pageheader($page_title, $meta_description);
pageheader(isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album]);
$page_title = (isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album]);
$meta_description = isset($CURRENT_ALBUM_DATA['description']) ? strip_tags(bb_decode($CURRENT_ALBUM_DATA['description'])) : $CONFIG['meta_description'];
$desc_len = strlen($meta_description);
if (isset($CURRENT_ALBUM_DATA)) $desc_len += strlen($lang_meta_album_names[$album])+3;
if ($page > 1) $desc_len += strlen($lang_thumbnails_php['page'] . " $page")+3;
if ($desc_len > 200) {
$offset = 170;
if (isset($CURRENT_ALBUM_DATA)) $offset -= strlen($lang_meta_album_names[$album])+3;
if ($page > 1) $offset -= strlen($lang_thumbnails_php['page'] . " $page")+3;
$meta_description = substr($meta_description, 0, strpos($meta_description, " ", $offset))."...";
}
if (!isset($CURRENT_ALBUM_DATA)) $meta_description .= " - " . $lang_meta_album_names[$album];
if ($page > 1) {
$page_title .= " - " . $lang_thumbnails_php['page'] . " $page";
$meta_description .= " - " . $lang_thumbnails_php['page'] . " $page";
}
$meta_description = "<meta name=\"description\" content=\"$meta_description\" />\n";
pageheader($page_title, $meta_description);
);
$lang_album_admin_menu = array(
'page' => 'Page',
// ------------------------------------------------------------------------- //
// File thumbnails.php
// ------------------------------------------------------------------------- //
if (defined('THUMBNAILS_PHP')) $lang_thumbnails_php = array(
'page' => 'Page'
);
// Void
if (mysql_num_rows($result) == 0)
cpg_die(CRITICAL_ERROR, $lang_errors['non_exist_cat'], __FILE__, __LINE__);
list($cat_desc) = mysql_fetch_array($result);
Really excellent workThanks a lot.
apart from i had to remove these lines of code for it to work apartThese lines extract categories description: what point in removing them? ???Code: [Select]if (mysql_num_rows($result) == 0)
cpg_die(CRITICAL_ERROR, $lang_errors['non_exist_cat'], __FILE__, __LINE__);
list($cat_desc) = mysql_fetch_array($result);
added my own custom description thing that you left out..Are you talking about the default description text in config.inc.php? :P
I have pumped all my displayimages into google with a little script which reads the Coppermine database and produces an XML file pointing to all the photos in the database. If anyone is interested I will post it on this forum. It generated 700+ entries and google accepted them all.Sounds like a Google sitemap (http://forum.coppermine-gallery.net/index.php/topic,18749.0.html)... ::)
I am not sure if search engines will look at two sets of meta tags - does anyone know.If you take a look at Google search results, it seems to take in account only the first one, as expected. Why duplicate tags?
Thanks Ludo this is fantastic.:-[ :-*
If there are multiple pages, then they will end up with the identical titles and descriptions tags. It would be great if there are multiple pages that the page number was added to the title and description tag.That's a good idea, I will work on accomplishing it ;)
It would also be great if the heading on the page (H1 tag) was the album name and the subtitle (H3) was the caption. This would greatly improve the page in Google's eyes as the H1 and H3 tags would no longer be the same on all pages (This is really bad from a search engine optimisation point of view).These suggestions aren't strictly related to this mod indeed...
displayimage.php
Again it would also be great if the heading on the page (H1 tag) was the album name and the subtitle (H3) was the caption. This would greatly improve the page in Google's eyes as the H1 and H3 tags would no longer be the same on all pages (This is really bad from a search engine optimisation point of view).
That's a good idea, I will work on accomplishing it ;)Done! ;D ;)
Done! ;D ;)
Look at source code of this page (http://vanrokken.altervista.org/thumbnails.php?album=86&page=3) for a demo.
"Title" is still duplicated. This could be fixed if current "Title" had "page n" added for all pages after the first page.Done (mod code updated :P )! 8)
There is also the problem of duplicate meta "description" for "Last additions", "Most Viewed" and "Top Rated". This could be resolved in a similar way to the thumbnails.php page number by adding "Last additions" at the end of the "description".
The "description" tag in the displayimage version of the "Last additions", "Most Viewed" and "Top Rated".Here it is (mod code updated)!
For example:
http://vanrokken.altervista.org/displayimage.php?album=lastup&cat=0&pos=32
$result = cpg_db_query("SELECT description FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid = '$cat'");
if (mysql_num_rows($result) == 0)
cpg_die(CRITICAL_ERROR, $lang_errors['non_exist_cat'], __FILE__, __LINE__);
list($cat_desc) = mysql_fetch_array($result);
if ($PAGE > 1) $cat_desc .= " - " . $lang_index_php['page'] . " $PAGE";
if (mysql_num_rows($result) > 0) {
list($cat_desc) = mysql_fetch_array($result);
if ($PAGE > 1) $cat_desc .= " - " . $lang_index_php['page'] . " $PAGE";
}
if (!empty($cat_desc)) |
if (empty($cat_desc)) $meta_description = strip_tags(bb_decode($cat)) . ' - ' . $CONFIG['gallery_name'];; mysql_free_result($result); |
DYNAMIC META DESCRIPTION TAGS MOD
This mod adds dynamic meta description tags to almost every page (categories, albums and images).
Meta description tag is filled respectively with category description, album description and image caption text, or, if it's not set, with a default site description set in config.inc.php.
HTML/BBCode tags stripped before building meta tag, if necessary.
Page number added both to meta description and page title in thumbnails page to avoid duplications when album spreads over multiple pages.
Thanks to GauGau for the hints above.
Files to edit:
include/config.inc.php
displayimage.php
index.php
thumbnails.php
lang/your_lang.php
OPEN
include/config.inc.php
FIND (at the end of file):Code: [Select]?>
BEFORE, ADDCode: [Select]// DEFAULT META DESCRIPTION TEXT
$CONFIG['meta_description'] = 'Your site default meta description text';
OPEN
displayimage.php
FIND (line 316)Code: [Select]if ($CURRENT_PIC_DATA['keywords']) { $meta_keywords = "<meta name=\"keywords\" content=\"".$CURRENT_PIC_DATA['keywords']."\"/>"; }
AFTER, ADDCode: [Select]$meta_description = empty($CURRENT_PIC_DATA['caption']) ? $CONFIG['meta_description'] : strip_tags(bb_decode($CURRENT_PIC_DATA['caption']));
$desc_len = strlen($meta_description);
if (!is_numeric($album)) $desc_len += strlen($album_name)+3;
if ($desc_len > 200) {
$offset = 170;
if (!is_numeric($album)) $offset -= strlen($album_name)+3;
$meta_description = substr($meta_description, 0, strpos($meta_description, " ", $offset))."...";
}
if (!is_numeric($album)) $meta_description .= " - " . $album_name;
$meta_description = "\n<meta name=\"description\" content=\"$meta_description\" />\n";
$meta_keywords .= $meta_description;
OPEN
index.php
FIND (line 756)Code: [Select]if (isset($cat)) {
BEFORE, ADDCode: [Select]$meta_description = $CONFIG['meta_description'];
FIND (line 757)Code: [Select]get_meta_album_set($cat,$META_ALBUM_SET);
AFTER, ADDCode: [Select]$result = cpg_db_query("SELECT description FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid = '$cat'");
if (mysql_num_rows($result) > 0) list($cat_desc) = mysql_fetch_array($result);
if (!empty($cat_desc)) {
$meta_description = strip_tags(bb_decode($cat_desc));
} else if ($cat >= FIRST_USER_CAT) {
$user_name = get_username($cat - FIRST_USER_CAT);
if (!$user_name) $user_name = 'Mr. X';
$meta_description = sprintf($lang_list_categories['xx_s_gallery'], $user_name);
}
mysql_free_result($result);
FIND (line 764)Code: [Select]pageheader($BREADCRUMB_TEXT ? $BREADCRUMB_TEXT : $lang_index_php['welcome']);
REPLACE WITHCode: [Select]$desc_len = strlen($meta_description);
if (isset($_GET['cat']) && $PAGE > 1) $desc_len += strlen($lang_index_php['page'] . " $PAGE")+3;
if ($desc_len > 200) {
$offset = 170;
if (isset($_GET['cat']) && $PAGE > 1) $offset -= strlen($lang_index_php['page'] . " $PAGE")+3;
$meta_description = substr($meta_description, 0, strpos($meta_description, " ", $offset))."...";
}
if (isset($_GET['cat']) && $PAGE > 1) $meta_description .= " - " . $lang_index_php['page'] . " $PAGE";
$meta_description = "<meta name=\"description\" content=\"$meta_description\" />\n";
$page_title = ($BREADCRUMB_TEXT) ? $BREADCRUMB_TEXT : $lang_index_php['welcome'];
if (isset($_GET['cat']) && $PAGE > 1) $page_title .= " - " . $lang_index_php['page'] . " $PAGE";
pageheader($page_title, $meta_description);
OPEN
thumbnails.php
FIND (line 163)Code: [Select]pageheader(isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album]);
REPLACE WITHCode: [Select]$page_title = (isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album]);
$meta_description = isset($CURRENT_ALBUM_DATA['description']) ? strip_tags(bb_decode($CURRENT_ALBUM_DATA['description'])) : $CONFIG['meta_description'];
$desc_len = strlen($meta_description);
if (isset($CURRENT_ALBUM_DATA)) $desc_len += strlen($lang_meta_album_names[$album])+3;
if ($page > 1) $desc_len += strlen($lang_thumbnails_php['page'] . " $page")+3;
if ($desc_len > 200) {
$offset = 170;
if (isset($CURRENT_ALBUM_DATA)) $offset -= strlen($lang_meta_album_names[$album])+3;
if ($page > 1) $offset -= strlen($lang_thumbnails_php['page'] . " $page")+3;
$meta_description = substr($meta_description, 0, strpos($meta_description, " ", $offset))."...";
}
if (!isset($CURRENT_ALBUM_DATA)) $meta_description .= " - " . $lang_meta_album_names[$album];
if ($page > 1) {
$page_title .= " - " . $lang_thumbnails_php['page'] . " $page";
$meta_description .= " - " . $lang_thumbnails_php['page'] . " $page";
}
$meta_description = "<meta name=\"description\" content=\"$meta_description\" />\n";
pageheader($page_title, $meta_description);
OPEN
lang/your_lang.php
FIND (line 1282)Code: [Select]);
$lang_album_admin_menu = array(
BEFORE, ADD (translate "Page" in your_lang!)Code: [Select]'page' => 'Page',
FIND (line 1714)Code: [Select]// ------------------------------------------------------------------------- //
// File thumbnails.php
// ------------------------------------------------------------------------- //
AFTER, ADD (translate "Page" in your_lang!)Code: [Select]if (defined('THUMBNAILS_PHP')) $lang_thumbnails_php = array(
'page' => 'Page'
);
FIND AND DELETE (line below)Code: [Select]// Void
SAVE AND CLOSE ALL FILES