Is there a way to create dynamic meta description for each (or most of them) page in Coppermine? For example:
<second part of tittle><constant text>
[Edit GauGau] The first few postings on this thread are the questions and unrelated discussion. If you're looking for the actual mod to accomplish dynamic meta descriptions, scroll down a little to the contribution by Ludo. [/edit]
Depends on where you want to put them. For the intermediate image display, edit displayimage.php, find <meta and edit the stuuf around it as you see fit. Basically, whenever the function pageheader is being called, you can add (as second parameter) any type of meta information. For details, post details.
Well, I was rather thinking about doing this in template files, 'cause I'd like to have dynamic descriptions for every page in gallery.
In displayimage.php there is a line:
if ($CURRENT_PIC_DATA['keywords']) { $meta_keywords = "<meta name=\"keywords\" content=\"".$CURRENT_PIC_DATA['keywords']."\"/>"; }
It's only about meta keywords. Could You give me an example of line which will give me a possibility to display constant text in meta description and a name of recent page? Like this:
$tit = <name of recent page> [e.g. Top Commented]
$cdesc = <constant defind description>
And display it like this:
<meta name="Description" content="{tit}{desc}{tit}" />
I have no idea what you're talking about. Is your meta tag's content suppossed to be dynamic or static? If it is suppossed to be dynamic, where should the content come from. If it's static, why don't you just edit themes/yourtheme/template.html as you see fit?
I want my meta description for every pages consists of TWO elements: first would be dynamic, second static.
Dynamic would be a name of current page, static would be a text defined by me (static element is supposed to be the same for all pages)
Schema for all pages:
<meta name="Description" content="<title of page><static text defined by me" />
It is a mix of dynamic and static elements, so can't be done via template.html.
All I want to know is how could I put title of page in meta description and where define my static text for display next to dynamic element.
As suggested above, this depends on what pages are suppossed to contain the meta tag and where you want to pull the dynamic data from. The title is being composed from the Gallery name that you have set up in Coppermine's config and whatever the coppermine page that you're on sends as content when calling the function pageheader.
Bottom line: edit whatever page you want to see changed and take a look at what is being sent to the pageheader function.
I told you above to post details. Any particular reason for not doing as suggested and playing hide and seek with me?
To be sincere, I don't exactly know what else details would You like to know.
I'll give You another example. Please look here: http://gryz.pl/faq.php When You take a look at the page source, You can see this line:
<title>Gryz.pl - Gry online. Nie do przegryzienia. - Często zadawane pytania</title>
This: "Gryz.pl - Gry online. Nie do przegryzienia." is a desc of gallery defined in admin panel, we don't care about it now.
This: "Często zadawane pytania" is a TITLE of this particular page, and I want to have this TITLE in my meta description tag. And I also want put a static text "on our gaming site" after this TITLE. So I would like compose it like this:
<meta name="Description" content="Często zadawane pytania on our gaming site" />
If name of a page would be "searching", I would like to have this "searching" in my meta desc + static text showed above so it'd be like this:
<meta name="Description" content="Searching on our gaming site" />
another example:
<meta name="Description" content="Last commented on our gaming site" />
etc.
I can't tell You on which pages I want to display this meta... or no, I can: I want diplay this on every page within my gallery. It can be done for every pages at once I guess. Within which file $meta is defined?
To change the meta tag of the FAQ page, edit faq.php, findpageheader($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.
Okay, so You know what I'd like to achieve :-)
Since only a couple of pages have their own ".php file" could You also tell me how can I get a title of page? Now, I would like to implement this for all pages, e.g. thumbnails.php:
pageheader(isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album]);
Is this okay?
$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);
Why don't you just try and give us feedback?
Hey Folks,
I'd really apprecaite it if someone could offer some ideas/help onhow to set this up.
Thank you.
Cheers
Carl
It works:
$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);
And similar one for diplayimage.php:
$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);
Last example doesn't show meta keywords (original lines do) since it's ignored by almost all search engines anyway.
Hi!
Ok, this is helpfull. But my question is: will this work when bridged with joomla!? Meta tags are loaded from joomla header and I would like to have image title or image description in meta tag.
Thanx for your time and help!
Quote from: GauGau on May 10, 2007, 03:57:34 PMWhy 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?".
Ok, my english is not so good so I did asked question wrong. I have allready bridged to joomla in wrapped mode so my coppermine gallery is wrapped in joomla template. Meta tags are loaded from joomla header. That's why I ask about meta tags from coppermine.
I'm sorry for missunderstund...please forgive me.
P.S. Link to my site is: http://www.fotoimota.net (http://www.fotoimota.net)
Thanx
Quote from: GauGau on June 06, 2007, 01:37:36 PM
"WE" represent you as a dev team and I really did understand that you do not know things about joomla.
I also understand that you hav 32000 post and that you are tired answering questions like mine. But please understand that someone else could give me answer...if someone else know things about joomla and Mehdi's bridge for coppermine. So, if you don't know the answer, don't answer and let other answer if they want. SMF Bridge for joomla solved problem with meta tags so coppermine bridge dev team, or someome else, could read this and help.
Thanke you!
Yes: someone who is familiar with both Coppermine and Joomla possibly could answer your question. However, you hijacked a thread that discusses meta tags used in a standalone coppermine environment. Your question would have belonged into a separate thread or (even better) into a support board that deals with Joomla. We allow questions that deal with what we know: Coppermine. If people post questions that do not deal with Coppermine, we tell them so. Our board is dedicated to Coppermine only. Just because somebody might come along who by accident is skilled both in Coppermine as well as Joomla doesn't make your question a valid one on the Coppermine support board. It's our decision what type of questions we want to see discussed. It's true that an answer that simply says "I don't know" doesn't make sense - generally speaking. So I should have said: "I don't know and your question is off topic and beyond the scope of this support board. Ask it somewhere else". We have strict rules on what kind of questions we allow on this forum to avoid it from being cluttered with irrelevant content. Somebody could as well post the question "how do I fix the engine of a Volkswagen Beetle?". Of course we could allow that sort of question, as there could be somebody who knows how to fix cars who accidentally visits the Coppermine board. However, we don't allow it. Your question is not as much off-topic as a question related to car repair would be. However, it's our choice what level of off-topic-ness we allow. That's why I haven't deleted your posting in the first place, but replied to it saying that you're suppossed to find help somewhere else.
I'm actually really tired having to explain our forum policies in details again and again. After all, it's our decision what kind of postings/questions we allow.
Joachim
Ok, I do apologize fot off topic. I didn't know it is off topic after all. My english language is not so good so I can not be shure if I'm wrong in something or not.
My language is croatian and I do know about off topic so please have a little maners on strangers. I'm not bad and do not want troubles. I need help and would like to help others. Delete this if you want. I don't care any more!
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):
?>
BEFORE, ADD
// DEFAULT META DESCRIPTION TEXT
$CONFIG['meta_description'] = 'Your site default meta description text';
OPEN
displayimage.php
FIND (line 316)
if ($CURRENT_PIC_DATA['keywords']) { $meta_keywords = "<meta name=\"keywords\" content=\"".$CURRENT_PIC_DATA['keywords']."\"/>"; }
AFTER, ADD
$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)
if (isset($cat)) {
BEFORE, ADD
$meta_description = $CONFIG['meta_description'];
FIND (line 757)
get_meta_album_set($cat,$META_ALBUM_SET);
AFTER, ADD
$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)
pageheader($BREADCRUMB_TEXT ? $BREADCRUMB_TEXT : $lang_index_php['welcome']);
REPLACE WITH
$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)
pageheader(isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album]);
REPLACE WITH
$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)
);
$lang_album_admin_menu = array(
BEFORE, ADD (translate "Page" in your_lang!)
'page' => 'Page',
FIND (line 1714)
// ------------------------------------------------------------------------- //
// File thumbnails.php
// ------------------------------------------------------------------------- //
AFTER, ADD (translate "Page" in your_lang!)
if (defined('THUMBNAILS_PHP')) $lang_thumbnails_php = array(
'page' => 'Page'
);
FIND AND DELETE (line below)
// Void
SAVE AND CLOSE ALL FILES
THANKS very useful
Really excellent work apart from i had to remove these lines of code for it to work apart from that tho its great, oh and added my own custom description thing that you left out..
if (mysql_num_rows($result) == 0)
cpg_die(CRITICAL_ERROR, $lang_errors['non_exist_cat'], __FILE__, __LINE__);
list($cat_desc) = mysql_fetch_array($result);
Quote from: Snaver on November 09, 2008, 01:26:30 AM
Really excellent work
Thanks a lot.
Quoteapart from i had to remove these lines of code for it to work apart
if (mysql_num_rows($result) == 0)
cpg_die(CRITICAL_ERROR, $lang_errors['non_exist_cat'], __FILE__, __LINE__);
list($cat_desc) = mysql_fetch_array($result);
These lines extract categories description: what point in removing them? ???
Quoteadded my own custom description thing that you left out..
Are you talking about the default description text in config.inc.php? :P
I used the displayimage.php mod to generate meta tag descriptions and keywords and have ended up with two of each as my Coppermine is integrated with Joomla. I have only used displayimage as 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.
I am not sure if search engines will look at two sets of meta tags - does anyone know.
You can see the dual meta tags when looking at the gallery in www.ukbigpeople.co.uk.
Regards
Richard
Quote from: RichardG on November 19, 2008, 03:33:56 AMI 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)... ::)
Quote from: RichardG on November 19, 2008, 03:33:56 AMI 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?
Sorry I should have mentioned it was a Google sitemap.
The duplication must be happening because the bridge does not take account of Coppermine and Joomla being together. Not sure where to start looking to add them together. May investigate further and add it here if I find a solution.
ludo that is great job, i kissed u, :-*
thx
:o :-* ;)
Thanks a lot Ludo, this is what I needed!
I have one question, do you know how I can get it to work for the displayimage page?
I didn't see the <mete description etc in the page source
As you can see by this example (http://vanrokken.altervista.org/displayimage.php?album=random&cat=0&pos=-493) from my gallery, dynamic meta descriptions do appear in image pages source :P ;)
Please make sure you modded properly displayimage.php file, and post a link to an image page in your gallery...
Thanks Ludo this is fantastic.
I was just about to post a request about this sort of thing as Google Webmaster Tools is reporting many problems with the Coppermine without this sort of modification. It says there are duplicate titles and duplicate meta descriptions, which tends to imply that it thinks that it may be duplicate content on the site. Either way it is not giving the Coppermine picture gallery content a good ranking in the SEO results.
I would like to suggest a few additional improvement to this mod:
thumbnails.php
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.
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).
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).
Quote from: whats_up_skip on December 08, 2008, 05:05:45 AM
Thanks Ludo this is fantastic.
:-[ :-*
QuoteIf 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 ;)
QuoteIt 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).
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).
These suggestions aren't strictly related to this mod indeed...
Quote from: Ludo on December 11, 2008, 03:15:21 PM
That's a good idea, I will work on accomplishing it ;)
Done! ;D ;)
Look at source code of this page (http://vanrokken.altervista.org/thumbnails.php?album=86&page=3) for a demo.
Quote from: Ludo on December 11, 2008, 03:48:06 PM
Done! ;D ;)
Look at source code of this page (http://vanrokken.altervista.org/thumbnails.php?album=86&page=3) for a demo.
I hadn't realised you had updated the code for thumbnails.php. Thanks for that.
This solves the issue of duplicate meta "description", however the "Title" is still duplicated. This could be fixed if current "Title" had "page n" added for all pages after the first page.
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 "Title" tag does not need to be changed as this is already different to the standard displayimage.
I suspect these are the duplicate issues that others had mentioned above and that they are not related to bridged application.
Thanks again for all your help with this mod, it is really improving our galleries in the eyes of Google.
Quote from: whats_up_skip on January 07, 2009, 06:45:19 AM
"Title" is still duplicated. This could be fixed if current "Title" had "page n" added for all pages after the first page.
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".
Done (mod code updated :P )! 8)
Demos:
Last additions (http://vanrokken.altervista.org/thumbnails.php?album=lastup&cat=0&page=3)
Most viewed (http://vanrokken.altervista.org/thumbnails.php?album=topn&cat=0&page=2)
Standard album (http://vanrokken.altervista.org/thumbnails.php?album=87&page=2)
You fixed something I had not thought of, but I don't think I explained clearly the other issue.
The "description" tag in the displayimage version of the "Last additions", "Most Viewed" and "Top Rated".
For example:
http://vanrokken.altervista.org/displayimage.php?album=lastup&cat=0&pos=32
<meta name="description" content="A sud del Bue, la vetta erbosa del Maggiorasca, anch'essa deturpata da ripetitori." />
Will be a duplicate of the normal version of the displayimage of this file. It needs to have something like "Last additions" added to the end of the description.
The same would also be the case for "Most Viewed" and "Top Rated".
Thanks again for you help with this. I have tried to make these changes myself, but I just don't have the php skills required.
Quote from: whats_up_skip on January 07, 2009, 10:33:23 PM
The "description" tag in the displayimage version of the "Last additions", "Most Viewed" and "Top Rated".
For example:
http://vanrokken.altervista.org/displayimage.php?album=lastup&cat=0&pos=32
Here it is (mod code updated)!
Wow that was fast and Thanks again.
We need to change your status from "Coppermine frequent poster" to Coppermine Legend".
found a bug in this mod,
file index.php
url in the user galleries stop working
*url's removed*
This doesn't look like a CPG-powered site at all...
@Magiks: Instead of posting url's that look fishy you might want to clarify what the bug is about.
Just for your information: I clicked on the 2 removed links and opened that site's homepage; now, I got 3 automated replies from forum@coppermine-gallery.net, despite I didn't send any email to that address.
Consider removing MAGIKS account.
Done. Thanks for the alert Ludo.
I am sorry for some misunderstandings which have arisen at my first attempt to inform about a error in this mod for the Coppermine gallery. Here detailed step-by-step infomation.
First, I installed latest release 1.4.21, then apply Ludo's mod "Dynamic meta descriptions", then turn on ability creating private user albums and created some public albums and categories. Then I uploaded some test images to all galleries.
All is fine, but all private user galleries didn't accessible (they numbers start from 10001, for example /index.php?cat=10001) gallery says "The selected category does not exist", however another public categories (which ID stats from 1) still accessible.
File index.php
$result = cpg_db_query("SELECT description FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid = '$cat'");
At attempt to access private user galleries (categories) we looking in the table "categories" for the CID 10001, but actually table have CID 1 for this category.
In file index.php, find
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";
and change it to
if (mysql_num_rows($result) > 0) {
list($cat_desc) = mysql_fetch_array($result);
if ($PAGE > 1) $cat_desc .= " - " . $lang_index_php['page'] . " $PAGE";
}
Mod code updated.
Hi, this is a great mod. One thing I think would be good is if you limit the number of words in your description meta tags, because if you write like a whole paragraph for an image description the meta tag will also be a whole pragraph of text won't it? I think Google etc prefer the description meta to be a maximum of about 200 characters, your page here: http://vanrokken.altervista.org/displayimage.php?album=lastup&cat=0&pos=32 for instance has 270 characters in the description, which is too long according to this tool: http://www.seocentro.com/tools/search-engines/metatag-analyzer.html
Although I wouldn't bother about 270 characters being too much, but if it was 500 I might? :)
Good point!
Mod code updated, now meta descriptions are truncated at the position of the first blank space after the 170th character (to manage long words without exceeding 200 words in any case).
Direct link to the MOD's code (http://forum.coppermine-gallery.net/index.php/topic,43650.msg226432.html#msg226432) [edit by PYAP]
Nice one. :)
Hi 8)Thanks to Ludo I've got meta descriptions almost for alll cats etc. But later on due to Webmaster tols I found that there are still many pages with identical descriptions. It's all about user's galleries: albums have descriptions, but cats don't. I hardly can coding so my solution is stupid but I'll show it hoping that somebody will improve it:
In file index.php, find]
Code:Add above it if (empty($cat_desc)) $meta_description = strip_tags(bb_decode($cat)) . ' - ' . $CONFIG['gallery_name'];; mysql_free_result($result); |
This mod adds meta description tag to categories pages too: each page will have a different description as long as each category has a different title. In my CPG I don't have user galleries, so I can't figure out any mod misbehaviour related to them...
Ludo, thank you for your answer -you are absolutely right: due to your mod every category do has meta description. But user galleries are formed in a different way, that's why I've made the small modification in order to prevent canonical issue. Naturally I don't mean that you personally have to brush it up. But maybe someone who have user galleries...
Huh, I got it! Forgot my previous reply and thanks for your suggestion. Mod code updated accordingly.
Ludo, thanks - it wasn't easy to get it because of my awful English(
thanks LUDO
i am very happy to with your mod to dynamic description. i have done it my my gallery. @ http://picturerating.us/picture-gallery/index.php
i want to know if there is any possiblity to make dynamic titles with some alteration in your code, i am looking for dynamic titles. i have started the thread for this help, but nothing found related to this. if you guide me, that will be great for cpg users.
http://forum.coppermine-gallery.net/index.php/topic,62105.0.html
Ludo, because of I have a lot of user's galleries I wasn't satisfied with my own solution - not only because of SEO: numbers in description can't tell anything to people. So at least I found the solution that seems more people friendly for me. Maybe you'll find it useful:
find
if (empty($cat_desc))
$meta_description = strip_tags(bb_decode($cat)) . ' - ' . $CONFIG['gallery_name'];
mysql_free_result($result);
& replace it with
$user_name = get_username($cat - FIRST_USER_CAT);
$meta_description = strip_tags(bb_decode($user_name)) . ' - ' . $lang_list_categories['home']. ' - ' .$CONFIG['gallery_name'];
mysql_free_result($result);
You seem to refer to a previous version of this mod: in the actual one user galleries are better managed ;)
:) You are right - code is already updated.
And what about title like this:
if (empty($cat_desc)) $page_title = strip_tags(bb_decode($user_name)) . ' - ' . $lang_list_categories['home'];
As for me it looks better than breadcrumbs
Quote from: Ludo on October 08, 2007, 04:19:15 PM
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):
?>
BEFORE, ADD
// DEFAULT META DESCRIPTION TEXT
$CONFIG['meta_description'] = 'Your site default meta description text';
OPEN
displayimage.php
FIND (line 316)
if ($CURRENT_PIC_DATA['keywords']) { $meta_keywords = "<meta name=\"keywords\" content=\"".$CURRENT_PIC_DATA['keywords']."\"/>"; }
AFTER, ADD
$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)
if (isset($cat)) {
BEFORE, ADD
$meta_description = $CONFIG['meta_description'];
FIND (line 757)
get_meta_album_set($cat,$META_ALBUM_SET);
AFTER, ADD
$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)
pageheader($BREADCRUMB_TEXT ? $BREADCRUMB_TEXT : $lang_index_php['welcome']);
REPLACE WITH
$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)
pageheader(isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album]);
REPLACE WITH
$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)
);
$lang_album_admin_menu = array(
BEFORE, ADD (translate "Page" in your_lang!)
'page' => 'Page',
FIND (line 1714)
// ------------------------------------------------------------------------- //
// File thumbnails.php
// ------------------------------------------------------------------------- //
AFTER, ADD (translate "Page" in your_lang!)
if (defined('THUMBNAILS_PHP')) $lang_thumbnails_php = array(
'page' => 'Page'
);
FIND AND DELETE (line below)
// Void
SAVE AND CLOSE ALL FILES
I have installed this mod : hopefully this will give me a better SEO...
http://www.orangewallpapers.com
( plz excuse my noobness) Is it installed correctly at my gallery ? I'm unsure.... Any suggestions plz ?
Hi,
It´s a great mod for begining, but would it be possible to use category or album names for meta keywords on index.php
Thx
Luka
Ludo thks
It´s a needed mod, espessialy for search engines.
I have installed this for fotogallery of Kaluga city (http://kalugafoto.com/)
I would start a new topic for "Custom Title and description for each page" , but I see information here that could be what I need. I'm not exactly sure what I'm looking at, but could somebody please tell me which code in this section I'll have to modify to achieve SEO friendly titles and descriptions for each page?