forum.coppermine-gallery.net

Support => cpg1.5 plugins => cpg1.5.x Support => cpg1.5 plugin contributions => Topic started by: Joe Carver on April 19, 2010, 07:16:45 pm

Title: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on April 19, 2010, 07:16:45 pm
This plugin will add the field <meta name="Description" content="xxx" /> to the <head> of your Image, Category and Album  pages where "xxx" will be the information in the description (caption) that you have entered. Search engines will then have more text to read from some of your pages.

Configuration page allows setting your custom text for Home, main Album List, Contact and Search page. Config. also allows option to add pic. owner's name to description for displayimage.php pages.

Note: Meta albums (top rated, last up, search, etc.) are not included - Coppermine 1.5.x discourages search engines from listing those pages.

  link rel="canonical"
Meta type picture pages (lastup, most viewed, search, last comment, top rated) now will get:
<link rel="canonical" href="h t t p://your_gallery.url/displayimage.php?album=xxx&pid=yyy " />
in the page <head>. This will help search engines to see which is the important page to list when Coppermine can generate the same image page based on top rated, most viewed, last comments, etc. The "base" image page is then seen as being the most important to list.

See Google Webmaster Help (http://www.google.com/support/webmasters/bin/answer.py?answer=139394) for more information.

Demonstration - Example (http://photos-by.joe-carver.com/index.php)

Enjoy
Title: Re: SEO friendly page headers Meta Descriptions for Category, Album List , Home
Post by: Joachim Müller on April 20, 2010, 06:54:11 pm
Coppermine 1.5.x discourages search engines from listing those pages.
Because of the abuse that the meta tags have suffered from in the past most search engines don't take them into account any longer. They are quite irrelevant imo, that's why they don't get populated. I suggest not to over-estimate the impact on search engine ranking that this little plugin will have. In my experience the impact is nearly void.
Content counts instead - real, visible, textual content; not some meta information.
Title: Re: SEO friendly page headers Meta Descriptions for Category, Album List , Home
Post by: Joe Carver on April 20, 2010, 08:49:50 pm
Perhaps I could been a little more verbose here...
Meta albums are not included - Coppermine 1.5.x discourages search engines from listing those pages.
I meant: Meta albums such as Lastup, Most viewed, etc are tagged with this in the <head>.
Quote
<meta name="robots" content="noindex, nofollow" />
(However, I have now just found and fixed a bug in the plugin that would have defeated that meta.)

Because of the abuse that the meta tags have suffered from in the past most search engines don't take them into account any longer. ....... I suggest not to over-estimate the impact on search engine ranking that this little plugin will have.
I agree - the plugin will not significantly increase search engine rankings.

They are quite irrelevant imo, that's why they don't get populated.
I kindly disagree given the condition that Google will use the meta description text as the page's/site's description when returning search results. It is what people will see along with the site's link.

Content counts instead - real, visible, textual content; not some meta information.
I agree 100%!

Before deciding to create (and share) this plugin I used this article as reference.
Changing your site's title and description in search results (http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=35264)

Quote
While accurate meta descriptions can improve clickthrough, they won't impact your ranking within search results. We frequently prefer to display meta descriptions of pages (when available) because it gives users a clear idea of the URL's content......high-quality descriptions can be displayed in Google's search results, and can go a long way to improving the quality and quantity of your search traffic.

(Intent is to clarify - not argue. Creating and deugging these is enough of a headache!)

Title: Re: SEO friendly page headers Meta Descriptions for Category, Album List , Home
Post by: Joe Carver on April 21, 2010, 01:59:05 pm
Release of Version 1.1

Title: Re: Meta Descriptions for Image, Category, Album List , Home - <head> data field
Post by: Joe Carver on April 23, 2010, 08:36:57 pm
Release of Version 1.2

Changelog

Details in changelog.txt. New version attached to first post in topic.
Title: Re: Add Description Meta Data to Gallery Pages in <HEAD>
Post by: Joe Carver on June 14, 2010, 06:21:22 pm
Release of Version 1.3

Changelog

New version now attached to first post. Old versions should be uninstalled and deleted before upgrading.

     ++++++

** See Google webmaster page about canonical references here Google Webmaster Help (http://www.google.com/support/webmasters/bin/answer.py?answer=139394)

and this thread
Support for Canonical meta tags (http://forum.coppermine-gallery.net/index.php/topic,65487.0.html)




Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: grantson on June 21, 2010, 06:02:47 pm
Nice :)

would it be possible to tweak this to add a custom title to the login.php page?

been trying to use this as an example and figure it out but how this does what it does is way over my head :(

Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joachim Müller on June 21, 2010, 08:53:03 pm
Start a separate thread of your own (or stick to the existing one) instead of spreading your issues over multiple unrelated threads.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Plazik on July 19, 2010, 02:36:37 pm
Hello. Thank you for this plugin. I have a few question:
1. Take for example this page http://photos-by.joe-carver.com/displayimage.php?album=52&pid=1163
This page http://photos-by.joe-carver.com/displayimage.php?pid=1163 is a copy of the previous one. This is not good.
Can you add rel=canonical to one of this page? It is desirable for the second page.
 
2. You title:
Code: [Select]
Hummingbirds - Hummingbird 5121435 carver - Photography by Joe CarverYou description:
Code: [Select]
Album Hummingbirds Hummingbird_5121435_carver.jpg Joe Carver photograph pictureCan you delete "_" from description?
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on July 20, 2010, 12:18:39 am
1. Take for example this page http://photos-by.joe-carver.com/displayimage.php?album=52&pid=1163
This page http://photos-by.joe-carver.com/displayimage.php?pid=1163 is a copy of the previous one. This is not good.
Can you add rel=canonical to one of this page? It is desirable for the second page.
Thanks for reminding me about that - I have considered changing the rel=cannonical link but I wanted to get the opinion of the developers first. The only concern that I have for showing the link as pid only is that many of the links (like from thumbnails,php) have the album id in the link. I am not sure if a crawler or visitor would see any links that have the pid only.

So to ask the developers......
With the intent of telling search engines which image page a meta album image page is related to:
Which link would be better to use?   displayimage.php?album=123pid=456   or   displayimage.php?pid=456
(thanks)

2. You title:
Code: [Select]
Hummingbirds - Hummingbird 5121435 carver - Photography by Joe CarverYou description:
Code: [Select]
Album Hummingbirds Hummingbird_5121435_carver.jpg Joe Carver photograph pictureCan you delete "_" from description?
That will be in the next release.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Αndré on July 20, 2010, 10:41:12 am
Which link would be better to use?   displayimage.php?album=123pid=456   or   displayimage.php?pid=456
displayimage.php?pid=456 as the album may change.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on July 20, 2010, 01:17:49 pm
Thank you Αndré. I think I will make that a config. selection.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Plazik on July 21, 2010, 08:35:09 am
displayimage.php?pid=456 as the album may change.
During 2 years I never change the albums. I think the other administrators also never changed their albums.
I always was used links like displayimage.php?album=123pid=456 and newer used displayimage.php?pid=456.
Joe Carver, Сan you add a choice of where to use rel=cannonical? on displayimage.php?album=123pid=456 or displayimage.php?pid=456? It would be wonderful.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Αndré on July 21, 2010, 08:44:48 am
During 2 years I never change the albums. I think the other administrators also never changed their albums.
It's possible to move images from one album to another. That's why I suggest to use the link without the album parameter.

I always was used links like displayimage.php?album=123pid=456 and newer used displayimage.php?pid=456.
Links like displayimage.php?album=123&pid=456 didn't exist in versions prior to cpg1.5.x. In cpg1.4.x you had links like displayimage.php?album=123&pos=456, but they pointed to a position in an album. If you upload just 1 image, a lot of positions may change. That's why displayimage.php?pid=456 always pointed to the same image.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on July 21, 2010, 12:11:10 pm
....Joe Carver, Сan you add a choice ........

I have already replied. It will be a choice in the plugin configuration. That change will come when I have the time to make it. Making major changes to a cpg1.5.x plugin can take some time and work. I might be able to finish it within the next week or so.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Plazik on July 21, 2010, 07:04:59 pm
Links like displayimage.php?album=123&pid=456 didn't exist in versions prior to cpg1.5.x. In cpg1.4.x you had links like displayimage.php?album=123&pos=456, but they pointed to a position in an album. If you upload just 1 image, a lot of positions may change. That's why displayimage.php?pid=456 always pointed to the same image.
I understand this.
But why not use only displayimage.php?pid=456 link anywhere? ???
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Αndré on July 21, 2010, 09:29:37 pm
We use the album parameter to determine if the user is viewing a regular album or a meta album. But that discussion doesn't belong in this thread.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on August 23, 2010, 12:57:46 am
Release of Version 1.4

Changelog

New version attached to first post. To upgrade: Save + Copy your current descriptions, uninstall and delete before uploading the new version.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: wbnp on August 28, 2010, 07:52:59 pm
Joe,

Very nice plugin, works great!

I have a suggestion that I think would work very well with papukaija's Facebook Sharer.

Would you consider, as part of your routine, also adding the Facebook image Meta Tag?

Code: [Select]
<link rel="image_src" href="thumbnail_image" / >

Code from:
http://developers.facebook.com/docs/share (http://developers.facebook.com/docs/share)

This would allow the thumbnail to be displayed on Facebook and would be great even if it was only applied to the Picture Page (displayimage) sub-routine.

Thanks for your time!

My site:
http://www.whyboysneedparents.com/ (http://www.whyboysneedparents.com/)
(VERY early stage of construction - if you need to, click on Home and you can get to normal Coppermine pages.

Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: papukaija on August 28, 2010, 10:23:15 pm
Would you consider, as part of your routine, also adding the Facebook image Meta Tag?
@Joe:As I wrote (http://forum.coppermine-gallery.net/index.php/topic,65740.msg332002.html#msg332002) to wbnp in the FB plugin topic, I can add that code to my plugin if you think that adding the extra FB code to your plugin isn't a good idea.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on August 31, 2010, 01:37:01 am
I can add that code to my plugin
That would be the best course of action. This plugin would need to have that add-on as a config. option. Some users would not want it. Adding the config, lang. and db changes adds a bit of work and time that I don't have at the moment.

It probably belongs more in the the Facebook plugin too, instead of this one.

If you get really stuck and can't make something that works I can probably post a mod.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: papukaija on September 01, 2010, 10:34:13 pm
It probably belongs more in the the Facebook plugin too, instead of this one.
That's what I thought but I wanted to be sure that we aren't both working on this.

If you get really stuck and can't make something that works I can probably post a mod.
I didn't get really stuck but however I have a small issue (http://forum.coppermine-gallery.net/index.php/topic,66886.0.html) with it.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: neil fitzgerald on September 09, 2010, 12:18:12 pm
I just installed v1.5 and, although it works as hoped for albums, I get empty meta description tags on category pages.
Albums is better than nothing, thanks, but fixing categories too would be even better.

(e.g. http://www.neilfitzgeraldphoto.co.nz/gallery/index-17.html)

Thanks,
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on September 09, 2010, 11:58:13 pm
Your site just timed out so a re-check was not possible. However earlier today....
I get empty meta description tags on category pages
Your site returned this:
Quote
<meta name="description" content="" />

Which showed the plugin is working and...you have no content in the field "Category description" in catmgr.php.

It might be an effect from your SEF urls plugin, something I can not fully test, but doubt is the case.

[edit] Your site went back up, (still slow though) there appeared to be no descriptions visible in your category pages either [/edit]
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: neil fitzgerald on September 10, 2010, 01:09:50 am
Thanks Joe, but the problem is that I do have content in the Category Description fireld in Cat manager, and, even if I didn't would it not default to the category title?
Yes, I thought SEF urls might be part of it, but since it works for Albums I hoped not.
Sounds like my host needs a kicking... then I'll try turning SEF urls off.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on September 10, 2010, 02:21:12 am
there appeared to be no descriptions visible in your category pages either

This still seems to be the case, but from here your site keeps timing out. Your category pages have no visible text for the category except for the title. If the Category description text does not show up in the cpg page then perhaps your theme is interfering.

........ would it not default to the category title?
Intentionally not - exact duplicate content is something I wanted to avoid when I wrote this plugin.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: neil fitzgerald on September 10, 2010, 03:08:57 am
This still seems to be the case, but from here your site keeps timing out. Your category pages have no visible text for the category except for the title. If the Category description text does not show up in the cpg page then perhaps your theme is interfering.
Yes, I don't have the cat description in my theme. So, I guess I need to dig into my theme to resolve this.
Quote
Intentionally not - exact duplicate content is something I wanted to avoid when I wrote this plugin.
Right, I misunderstood the docs.

Server has apparently had a hardware infarction...
Thanks for the nice plugin and help.
Neil.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: neil fitzgerald on September 11, 2010, 01:53:41 am
Intentionally not - exact duplicate content is something I wanted to avoid when I wrote this plugin.
We may be misunderstanding each other. If the category title is not a fall back if there is no category description, what does this in codebase do:
Code: [Select]
else  {
            $new_meta = <<< EOT
<meta name="description" content="$this_title" />

I ran through all the basic themes and none produce a meta description, using category title or description, on any category pages. Could this be because none of them actually show a category description for the current category, only with the thumbnails of child categories? Anyway, if it doesn't work for the standard themes it has me thinking there is something else involved.
I can point you to my test site off the board if you like.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on September 11, 2010, 04:32:42 am
what does this in codebase do:
It returns an empty "" as you have seen.

To quote from the doc.
Quote
The plugin will be most effective when you add descriptions to your content and pages.

I suppose I could change it to return nothing at all. A default/configurable/single description would not make sense. It would be repetitive for the categories where the user doesn't take the time to fill in some content for the category. Maybe I'll take a look for the next release.

if it doesn't work for the standard themes
Does for me. I have now just uploaded all of the cpg 1.5.8 themes to my test/demo gallery. Curve is slightly modified, the others are straight from the download. On cat. pages with a description you get a description meta when you go to the category. It matches what the description was on the previous page. On categories with no description there is no meta. On a second cpg 1.5.8 gallery I have tried this going three deep into subcategories - it works there too.

I can point you to my test site off the board if you like.
It doesn't work like that here. The moderators of this forum want a link to be publicly posted with help requests. Keep that in mind for the future.
For the moment here is the link to my test gallery where the plugin works with all of the themes I have tried.
http://photos-by.joe-carver.com/index.php
 
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: neil fitzgerald on September 11, 2010, 06:26:02 am
Ok, I set up a clean new install, cpg158 (new download, new DB), and 1.4 of this plugin.
(http://www.alpha.neilfitzgeraldphoto.co.nz/cpg15x/)
Albums work fine (as for my working site) but categories only give whatever is entered into the plugin config, including "" if it is left blank.
 ???

Please excuse my ignorance, but this does help me learn; could you not just omit $this_title from the code I copied above and have content="" if all you want is an empty ""?

Thanks for your help.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on September 11, 2010, 02:13:14 pm
Sorry, I can not reproduce the problem. I have just removed 13 plugins from my second test gallery to confirm that it works ok - it did. If I find something in the future I will post a solution. Perhaps someone else can shed some light on it too.

Maybe the copy of the plugin you have downloaded is corrupted.

You can always modify the code to suit your wishes - it is open source.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on September 12, 2010, 01:29:46 pm
@ neil fitzgerald,

If you can, please turn on debug and show notices to everyone in your test gallery. I will tale a look over the next day to see if it shows anything helpful as to why this works differently for you.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: neil fitzgerald on September 12, 2010, 10:22:36 pm
On, thank you.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on September 13, 2010, 01:57:32 am
Do you have notices turned on?    Config  >> Maintenance settings  >> Display notices in debug mode

It might be how $cat is being read or not.

Since I don't see the same issue you will have to test if this fixes it for you. It works fine without noticeable change on my test gallery.

Download the text file, rename it to codebase.php and upload it to - plugins/description_metas/.

[edit] delete attachment
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: neil fitzgerald on September 13, 2010, 02:18:24 am
Sorry, I turned on debug for everyone but not notices. Have done that now and it's telling me "Undefined index: dbcharset".
Will try the new file, thanks.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: neil fitzgerald on September 13, 2010, 02:23:04 am
Well, that codebase file killed it completely. Reverting now.
"Warning: Unexpected character in input: ''' (ASCII=39) state=1 in /hsphere/local/home/neilfitz/alpha.neilfitzgeraldphoto.co.nz/cpg15x/plugins/description_metas/codebase.php on line 340 Parse error: syntax error, unexpected $end, expecting ']' in /hsphere/local/home/neilfitz/alpha.neilfitzgeraldphoto.co.nz/cpg15x/plugins/description_metas/codebase.php on line 340 "
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on September 13, 2010, 03:19:32 am
"Undefined index: dbcharset".
That is meaningless in this context so will some other notices that will show from time to time.

Well, that codebase file killed it completely. Reverting now.

I found one error, although it should have not have quit so rudely....

Try this, try to make sure the file remains as UTF-8 without B.O.M. .

[edit] deleted attachment

If it doesn't work then I will take another look later on in a day or do.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: neil fitzgerald on September 13, 2010, 03:36:39 am
Your files were missing the last few lines. Added from original codebase (as attached) and we now have some progress. Categories now have the category title in meta description, but still no category description.
Appreciate your time on this.



[edit] file removed - Joe Carver
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on September 13, 2010, 03:53:34 am
Your files were missing the last few lines.
Strange, I don't understand where that came from - they will all be deleted in two seconds.

Try this, otherwise I have to give it a rest.
[edit] file removed - Joe Carver
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: neil fitzgerald on September 13, 2010, 04:14:22 am
still truncated mid line 346.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: neil fitzgerald on September 13, 2010, 04:27:12 am
..but after adding the missing few lines (as attached) we have it working properly!
Thank you very much ;D
I hope there is something in this for others too.
Joe, if you can explain what's going on in layman's terms I'm interested (keen to learn and self help as much as possible).
Cheers,
Neil.


[edit] file removed - Joe Carver
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on September 13, 2010, 04:47:46 am
..but after adding the missing few lines.....
....if you can explain what's going on.....
Why the lines have gone missing in the upload/download to and from here is beyond me.

Why the plugin worked differently I can answer more exactly to effect rather than root cause.

The plugin uses/used the variable $cat which (for me and my testing) returns the number of the current catalog. For some reason (the root cause) both of your setups returned an empty value for $cat which the plugin interpreted as a 0 (zero). It then used that 0 to return the description for the main album page.

I changed the plugin so that the catalog number is read through a Supercage get.
Code: [Select]
// grab category by supercage get
$superCage = Inspekt::makeSuperCage();
  if ($superCage->get->keyExists('cat')) {
$now_cat = $superCage->get->getInt('cat');
 }

I am glad that it works for you. Thanks for the testing info.
Now it will be time for another release.



Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on September 15, 2010, 02:18:22 am
Release of Version 1.5

Changelog

To upgrade:
Versions older than 1.4 must uninstall/delete/upload/reinstall.
Back up your descriptions first.
Version 1.4 can be upgraded by replacing codebase.php only.

This might be more "friendly" to SEF urls - testing reports / results are requested.

New version attached to first post in thread.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: nickelas on September 17, 2010, 11:34:28 am
Thank you for this plugin.
One question, it looks like it adds the filename to the meta description if there is no description to the image. Could this be a config (to leave out the filename)?
http://uppsalafoto.se/galleri/ 
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on September 17, 2010, 11:57:30 am
Could this be a config (to leave out the filename)?

I will take a look for the next release.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: profili on January 04, 2011, 11:13:07 pm
The Canonical tag is not working when a file is visited from an album.
E.g, the album http://www.galsh.com/thumbnails-22.html
One photo in this album http://www.galsh.com/displayimage-22-46374.html#top_display_media
As you can see no canonical tag here! Can you fix this please!
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on January 04, 2011, 11:42:48 pm
The Canonical tag is not working when a file is visited from an album.
That is the intent of the design. The canonical tag would show only if you see that picture by clicking it from meta albums. (Lastup, Most viewed, Last comment, etc.)

Canonical is in this Coppermine plugin to tell the search sites:
   "This meta page is related to the main image page."

The main image page is always what the album page has for links.

Can you fix this please!
Try reading the links on the first page in this thread.
There is nothing to fix here.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: profili on January 05, 2011, 12:09:25 am
If the Google bot will visit this url http://www.galsh.com/displayimage-22-46374.html#top_display_media and there is no canonical tag, it will index it. But this is not the  permalink of this file. This is the permalink http://www.galsh.com/displayimage-46374.html
That's why the canonical tag should work everytime if there are multiple URLs for the same content. I hope you understand what I mean. Thank you.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on January 05, 2011, 12:33:02 am
What have you set in the plugin config for that variable? PID or AID + PID?



Please bear in mind that SEF urls may change the behavior of the plugin too.


This is the permalink......
Where does that link come from? From which page does a search engine find it?
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: profili on January 05, 2011, 08:20:05 am
What have you set in the plugin config for that variable? PID or AID + PID?
Please bear in mind that SEF urls may change the behavior of the plugin too.


I use PID.

Quote
Where does that link come from? From which page does a search engine find it?

Under "File information" is the unique url for each file. But more important for Google is to see only one url for one content. And Canonical tag is ideal for this.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: profili on January 10, 2011, 01:34:42 am
No chance to have here a complete solution for canonical tag for Copperimine Gallery, right?
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Ulenka on October 18, 2012, 11:17:59 am
I want to add "Descriptions of album" in meta-description. Which code put into "Set Meta Description - Album List page"?
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on October 19, 2012, 11:31:23 am
It is difficult to understand which page(s) you are asking about.

Please post a link to the exact page that you describe.

Posting a link to your Coppermine is required by the Board Rules (http://forum.coppermine-gallery.net/index.php/topic,55415.msg270616.html#msg270616)
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: astrasuite on June 14, 2013, 02:48:09 am
Hi, Joe,

Thanks for this plugin, excellent.

Overall great.  It shows the same desc for urls like these though :

http://www.astrasuite.com/client-system-albums/displayimage.php?album=129&pid=1659

http://www.astrasuite.com/client-system-albums/displayimage.php?pid=1659


Could it be possible to include an option to replace meta Title as well ?  With a random number generated to append at the end of the title to ensure all titles are unique (maybe done to meta description as well)


Thanks
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: astrasuite on June 14, 2013, 04:53:30 am
p.s.  Never mind about the title, I was able to make it unique by modifying /include/themes.inc.php

I just changed this :

'{TITLE}' => theme_page_title($section),

to this :

'{TITLE}' => theme_page_title($section) . " | " . rand(1,1000),


Maybe I'll do the same to the desc ...
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: astrasuite on July 01, 2013, 12:37:50 am
Never mind about the description too, I got it to be unique now, same with title.  While taking care of the recommended lengths by Google, I just append the last few characters of the current url to both title and description, rather than rand(), and it's always unique now, while being constant.

So for my two examples above, same image but different url, no more duplicates.  Down from 2000+ reported by Google Webmaster to zero ...

Thanks for the plugin ...
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Walkinman on December 31, 2013, 05:23:03 am
Is there a way to config this plugin so that it does NOT add a description tag to albums? I have tweaked things so I can write custom meta tags for description on my site (for album pages (and categories if I can figure that part out)), and it's causing 2 tags to be generated .. I would like to keep this plugin mainly for the image display pages.


Astrasuite - would you mind posting how you did that for the description tag? I'm also getting tons of duplicate description tags on the google and would like to find an easier way to fix it than doing it manually. I played with the themes.inc.php file a bit but couldn't make anything work.

Thanks.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Walkinman on December 31, 2013, 06:23:41 am
PS: OK .. so I found a way to do add a description to the image display via this thread
http://forum.coppermine-gallery.net/index.php/topic,17275.msg98259.html#msg98259
Code: [Select]
if ($CURRENT_PIC_DATA['title']) { $meta_keywords .= "<meta name=\"description\" content=\"".$CURRENT_PIC_DATA['caption']."\">"; }

and I added this so they're not duplicates
Code: [Select]
if ($CURRENT_PIC_DATA['title']) { $meta_keywords .= "<meta name=\"description\" content=\"".$CURRENT_PIC_DATA['caption']. " | Image = #".$pid."\">"; }
So the tag is constant and unique. So I think I have that figured out. Now, how to get my the meta tag to display on the category pages, and I think I'll be getting somewhere! Ideally I'd like to limit the caption in the meta tag to maybe 150 characters, but I don't know how to do that.

Having got this done, I've uninstalled the plugin, Joe, so no need to address my earlier question about an option to NOT add a desc to albums. Unless it's of some value to others, of course.

Thanks.

Cheers

Carl
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: astrasuite on March 29, 2014, 05:38:57 am
Sorry, Walkinman, didn't see this ... anyway, mine is a lot of change, and results may not be for everyone.

Here is the whole codebase.php, I commented my changes with "jcr", and others have "jcr" so it's understandable ...

Code: [Select]
<?php
  
/*******************************************************
   Add Meta Descriptions and canonical references 
   By Joe Carver 
Version 1.5 - 14 September 2010 
  *******************************************************/
  
    
require_once('include/init.inc.php');
    if (!
defined('IN_COPPERMINE')) {die('Not in Coppermine...');}
global $CONFIG$CPG_PHP_SELF$template_header;

// Add plugin_install action
$thisplugin->add_action('plugin_install','add_meta_install');

// Add plugin_uninstall action
$thisplugin->add_action('plugin_uninstall','add_meta_uninstall');

function char_convert($str_a) {  // convert some characters if sanitized in db entry
$str_a str_replace(array('&amp;''&quot;''&lt;''&gt;''&#38;#039;''&#38;#39;' '_' '-'), array('&''"''<''>'"'""'"'  ''  ') ,$str_a);
return  $str_a;
}
// grab category by supercage get
$superCage Inspekt::makeSuperCage();
$now_cat '';
if ($superCage->get->keyExists('cat')) {
$now_cat $superCage->get->getInt('cat');
  }

//  meta descrptions for category with albums
if ($CPG_PHP_SELF == 'index.php' && $now_cat 0) {  
    
$thisplugin->add_filter('theme_pageheader_params','add_meta_description');
function add_meta_description($template_vars) {
    global  $CONFIG$LINEBREAK$template_header$meta$CURRENT_CAT_NAME;

// jcr - get current url
global $jcr_current_url;
 
$jcr_current_url jcr_getCurrentUrl();
$jcr_current_url str_replace('/','',substr($jcr_current_url,0));
        
$jcr_current_url str_replace('-','',substr($jcr_current_url, -18));

// grab category by supercage get
$superCage Inspekt::makeSuperCage();
 
if ($superCage->get->keyExists('cat')) {
$now_cat $superCage->get->getInt('cat');
  }       
$result cpg_db_query("SELECT description FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid = '$now_cat'");
        
$row mysql_fetch_array($result);
        
$this_cat char_convert(strip_tags(bb_decode($row['description'])));
$this_cat str_replace('"','',substr($this_cat,0));
mysql_free_result($result);

        
$this_title substr(char_convert($CURRENT_CAT_NAME),0,135) . ' / ' $jcr_current_url;
$this_title str_replace('"','',substr($this_title,0));
if (strlen($this_title) < 130)
$this_title $this_title ' / This is an album gallery of some client systems';
if (strlen($this_title) < 100)
$this_title $this_title ' / We supply high-end audio that respect music with emotion';
    if ($this_cat != '')  {
$this_cat substr($this_cat,0,135) . ' / ' $jcr_current_url;
if (strlen($this_cat) < 130)
$this_cat $this_cat ' / This is an album gallery of some client systems';
if (strlen($this_cat) < 100)
$this_cat $this_cat ' / We supply high-end audio that respect music with emotion';
    $new_meta = <<< EOT
<meta name="description" content="$this_cat" /> 
EOT;
            } else  {
        $new_meta = <<< EOT
<meta name="description" content="$this_title" /> 
EOT;
    }

$current_meta $template_vars['{META}'];
$cat_meta = array('{META}' => $current_meta $new_meta);
return array_merge($template_vars$cat_meta);

}
    }

    
// meta descrptions for albums
if ($CPG_PHP_SELF == 'thumbnails.php') {
    
$thisplugin->add_filter('theme_pageheader_params','add_meta_description');
function add_meta_description($template_vars) {
        global 
$album$aid$LINEBREAK$CONFIG$template_header$meta$page$lang_common;
// jcr - get current url
global $jcr_current_url;
 
$jcr_current_url jcr_getCurrentUrl();
$jcr_current_url str_replace('/','',substr($jcr_current_url,0));

$jcr_current_url str_replace('-','',substr($jcr_current_url, -18));

    $result cpg_db_query("SELECT description, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = '$album'");
        
$row mysql_fetch_array($result);
        
$this_alb strip_tags(bb_decode($row['description']));
$this_alb str_replace('"','',substr($this_alb,0));
        
$this_title substr(char_convert(strip_tags(bb_decode($row['title']))),0,135) . ' / ' $jcr_current_url;
$this_title str_replace('"','',substr($this_title,0));
if (strlen($this_title) < 130)
$this_title $this_title ' / This is an album gallery of some client systems';
if (strlen($this_title) < 100)
$this_title $this_title ' / We supply high-end audio that respect music with emotion';
mysql_free_result($result);

$meta_robo_array = array( // exclude meta albums list
    
'lastup',
    
'lastcom',
    
'topn',
    
'toprated',
    
'favpics',
    
'random',
    
'datebrowse',
'lastcomby',
'lastupby',
'lasthits',
'search',
'lastalb',
'favpics'
    );


    if ($page 0)  {
$this_page_num ' Page' ' ' $page;
    } else  {
        $this_page_num '';
    }
    if ($this_alb != '')  {
$this_alb =  substr($this_alb,0,135) . ' / ' $jcr_current_url;
if (strlen($this_alb) < 130)
$this_alb $this_alb ' / This is an album gallery of some client systems';
if (strlen($this_alb) < 100)
$this_alb $this_alb ' / We supply high-end audio that respect music with emotion';
$alb_meta = <<< EOT
<meta name="description" content="$this_alb . $this_page_num" /> 
EOT;
        } else  {
        $this_title $this_title ' ' $lang_common['album'] . ' ' $this_page_num ' ';
        $alb_meta = <<< EOT
<meta name="description" content="$this_title" /> 
EOT;
}
        
$superCage Inspekt::makeSuperCage();
        if (
in_array($superCage->get->getAlpha('album'), $meta_robo_array)) {
    $alb_meta '';
    } 

$current_meta $template_vars['{META}'];
$cat_meta = array('{META}' => $current_meta $alb_meta);
return array_merge($template_vars$cat_meta);
}
    }

//  meta descrptions for Home Page
// determine page location - home or first album list page
$superCage Inspekt::makeSuperCage();
if ($CPG_PHP_SELF == 'index.php' && !$superCage->get->keyExists('cat')) {

$thisplugin->add_filter('theme_pageheader_params','add_meta_description');
function add_meta_description($template_vars) {
    global $CONFIG$LINEBREAK$template_header$meta;

// jcr - get current url
global $jcr_current_url;
 
$jcr_current_url jcr_getCurrentUrl();
$jcr_current_url str_replace('/','',substr($jcr_current_url,0));

$jcr_current_url str_replace('-','',substr($jcr_current_url, -18));

$home_meta substr(char_convert($CONFIG['add_meta_home']),0,135) . ' / ' $jcr_current_url;
$home_meta str_replace('"','',substr($home_meta,0));
if (strlen($home_meta) < 130)
$home_meta $home_meta ' / This is an album gallery of some client systems';
if (strlen($home_meta) < 100)
$home_meta $home_meta ' / We supply high-end audio that respect music with emotion';

    
$new_meta = <<< EOT
<meta name="description" content="$home_meta" />
$LINEBREAK
EOT;

$current_meta $template_vars['{META}'];
$cat_meta = array('{META}' => $current_meta $new_meta);
return array_merge($template_vars$cat_meta);
}
    }

//  meta descrptions for main Album List Page
$superCage Inspekt::makeSuperCage();
if ($CPG_PHP_SELF == 'index.php' && $superCage->get->keyExists('cat') && $now_cat 1) {
$thisplugin->add_filter('theme_pageheader_params','add_meta_description');
function add_meta_description($template_vars) {
    global $CONFIG$LINEBREAK$template_header$meta;

// jcr - get current url
global $jcr_current_url;
 
$jcr_current_url jcr_getCurrentUrl();
$jcr_current_url str_replace('/','',substr($jcr_current_url,0));

$jcr_current_url str_replace('-','',substr($jcr_current_url, -18));

    $alblist_meta substr(char_convert($CONFIG['add_meta_alblist']),0,135) . ' / ' $jcr_current_url;
$alblist_meta str_replace('"','',substr($alblist_meta,0));
if (strlen($alblist_meta) < 130)
$alblist_meta $alblist_meta ' / This is an album gallery of some client systems';
if (strlen($alblist_meta) < 100)
$alblist_meta $alblist_meta ' / We supply high-end audio that respect music with emotion';
        
$new_meta = <<< EOT
<meta name="description" content="$alblist_meta" />
$LINEBREAK
EOT;

$current_meta $template_vars['{META}'];
$cat_meta = array('{META}' => $current_meta $new_meta);
return array_merge($template_vars$cat_meta);
}
    }
    

//  meta descrptions for Search Page
if ($CPG_PHP_SELF == 'search.php')
{
    $thisplugin->add_filter('theme_pageheader_params','add_meta_description');
    function add_meta_description($template_vars) {
    global $CONFIG$LINEBREAK$template_header$meta;

// jcr - get current url
global $jcr_current_url;
 
$jcr_current_url jcr_getCurrentUrl();
$jcr_current_url str_replace('/','',substr($jcr_current_url,0));

$jcr_current_url str_replace('-','',substr($jcr_current_url, -18));

    $search_meta substr(char_convert($CONFIG['add_meta_search']),0,135) . ' / ' $jcr_current_url;
$search_meta str_replace('"','',substr($search_meta,0));
if (strlen($search_meta) < 130)
$search_meta $search_meta ' / This is an album gallery of some client systems';
if (strlen($search_meta) < 100)
$search_meta $search_meta ' / We supply high-end audio that respect music with emotion';
        
$new_meta = <<< EOT
<meta name="description" content="$search_meta" />
$LINEBREAK
EOT;

$current_meta $template_vars['{META}'];
$cat_meta = array('{META}' => $current_meta $new_meta);
return array_merge($template_vars$cat_meta);
}
    }

//  meta descrptions for Picture Page
if ($CPG_PHP_SELF == 'displayimage.php') {
$thisplugin->add_filter('theme_pageheader_params','add_meta_description');

    function 
add_meta_description($template_vars) {
    global $CONFIG$LINEBREAK$template_header$meta$CURRENT_PIC_DATA$lang_common$CURRENT_ALBUM_DATA$pic_pos;

// jcr - get current url
global $jcr_current_url;
 
$jcr_current_url jcr_getCurrentUrl();
$jcr_current_url str_replace('/','',substr($jcr_current_url,0));

$jcr_current_url str_replace('-','',substr($jcr_current_url, -18));

if ($CONFIG['add_meta_owner_name'] == 1)  {
$pic_owner_number $CURRENT_PIC_DATA['owner_id'];
$result cpg_db_query("SELECT user_name FROM {$CONFIG['TABLE_USERS']} WHERE user_id = '$pic_owner_number'");
        
$row mysql_fetch_array($result);
        
$pic_owner_name char_convert(strip_tags(bb_decode($row['user_name'])));
mysql_free_result($result);
        }
else  {
        
$pic_owner_name '';
        }


if ($CURRENT_PIC_DATA['caption'] != '') {
    $pic_meta char_convert(strip_tags(bb_decode($CURRENT_PIC_DATA['caption'])))  . '  ' $pic_owner_name ' ' char_convert($CONFIG['add_meta_pics']);
$pic_meta substr($pic_meta,0,135) . ' / ' $jcr_current_url;
$pic_meta str_replace('"','',substr($pic_meta,0));
if (strlen($pic_meta) < 130)
$pic_meta $pic_meta ' / This is an album gallery of some client systems';
if (strlen($pic_meta) < 100)
$pic_meta $pic_meta ' / We supply high-end audio that respect music with emotion';

        
$new_meta = <<< EOT
<meta name="description" content="$pic_meta" /> 

EOT;
            } else  {
        $home_meta char_convert(strip_tags(bb_decode($CURRENT_PIC_DATA['title']))) . ' ' $lang_common['album'] . ' ' char_convert(strip_tags(bb_decode($CURRENT_ALBUM_DATA['title']))) . ' ' char_convert(strip_tags(bb_decode($CURRENT_PIC_DATA['filename']))) . ' ' $pic_owner_name ' ' char_convert($CONFIG['add_meta_pics']) . $pic_pos;
$home_meta substr($home_meta,0,135) . ' / ' $jcr_current_url;
$home_meta str_replace('"','',substr($home_meta,0));
if (strlen($home_meta) < 130)
$home_meta $home_meta ' / This is an album gallery of some client systems';
if (strlen($home_meta) < 100)
$home_meta $home_meta ' / We supply high-end audio that respect music with emotion';

            
$new_meta = <<< EOT
<meta name="description" content="$home_meta" />

EOT;
}

$meta_robo_array = array( // array to not list description, but to add link rel="canonical
    
'lastup',
    
'lastcom',
    
'topn',
    
'toprated',
    
'favpics',
    
'random',
    
'datebrowse',
'lastcomby',
'lastupby',
'lasthits',
'search',
'lastalb',
'favpics'
    );

    
$superCage Inspekt::makeSuperCage();
    if (
in_array($superCage->get->getAlpha('album'), $meta_robo_array)) {
$this_album  $CURRENT_PIC_DATA['aid'];
$this_file  $CURRENT_PIC_DATA['pid'];

    if (
$CONFIG['add_meta_pid'] == 1)  {
$this_pic  = <<< EOT
displayimage.php?pid=$this_file
EOT;

}  else  {
$this_pic  = <<< EOT
displayimage.php?album=$this_album&pid=$this_file
EOT;
    }

$this_address $CONFIG['site_url'];
$this_canon $this_address $this_pic;
   
$new_meta = <<< EOT
<link rel="canonical" href="$this_canon" />

EOT;
    } 


$current_meta $template_vars['{META}'];
$cat_meta = array('{META}' => $current_meta $new_meta);

    return 
array_merge($template_vars$cat_meta);
}
    }


//  meta descrptions for Contact Page
if ($CPG_PHP_SELF == 'contact.php')
{
    $thisplugin->add_filter('theme_pageheader_params','add_meta_description');
    function add_meta_description($template_vars) {
    global $CONFIG$LINEBREAK$template_header$meta;

// jcr - get current url
global $jcr_current_url;
 
$jcr_current_url jcr_getCurrentUrl();
$jcr_current_url str_replace('/','',substr($jcr_current_url,0));

$jcr_current_url str_replace('-','',substr($jcr_current_url, -18));

    $contact_meta substr(char_convert($CONFIG['add_meta_contact']),0,135) . ' / ' $jcr_current_url;
$contact_meta str_replace('"','',substr($contact_meta,0));
if (strlen($contact_meta) < 130)
$contact_meta $contact_meta ' / This is an album gallery of some client systems';
if (strlen($contact_meta) < 100)
$contact_meta $contact_meta ' / We supply high-end audio that respect music with emotion';

        
$new_meta = <<< EOT
<meta name="description" content="$contact_meta" />
EOT;

$current_meta $template_vars['{META}'];
$cat_meta = array('{META}' => $current_meta $new_meta);
return array_merge($template_vars$cat_meta);
}
    }


//  meta descrptions for Register Page
if ($CPG_PHP_SELF == 'register.php')
{
    $thisplugin->add_filter('theme_pageheader_params','add_meta_description');
    function add_meta_description($template_vars) {
    global $CONFIG$LINEBREAK$template_header$meta;

// jcr - get current url
global $jcr_current_url;
 
$jcr_current_url jcr_getCurrentUrl();
$jcr_current_url str_replace('/','',substr($jcr_current_url,0));

$jcr_current_url str_replace('-','',substr($jcr_current_url, -18));

    $register_meta substr(char_convert($CONFIG['add_meta_register']),0,135) . ' / ' $jcr_current_url;
$register_meta str_replace('"','',substr($register_meta,0));
if (strlen($register_meta) < 130)
$register_meta $register_meta ' / This is an album gallery of some client systems';
if (strlen($register_meta) < 100)
$register_meta $register_meta ' / We supply high-end audio that respect music with emotion';

        
$new_meta = <<< EOT
<meta name="description" content="$register_meta" />
EOT;

$current_meta $template_vars['{META}'];
$cat_meta = array('{META}' => $current_meta $new_meta);
return array_merge($template_vars$cat_meta);
}
    }


//  meta descrptions for Login Page
if ($CPG_PHP_SELF == 'login.php')
{
    $thisplugin->add_filter('theme_pageheader_params','add_meta_description');
    function add_meta_description($template_vars) {
    global $CONFIG$LINEBREAK$template_header$meta;

// jcr - get current url
global $jcr_current_url;
 
$jcr_current_url jcr_getCurrentUrl();
$jcr_current_url str_replace('/','',substr($jcr_current_url,0));

$jcr_current_url str_replace('-','',substr($jcr_current_url, -18));

    $login_meta substr(char_convert($CONFIG['add_meta_login']),0,135) . ' / ' $jcr_current_url;
$login_meta str_replace('"','',substr($login_meta,0));
if (strlen($login_meta) < 130)
$login_meta $login_meta ' / This is an album gallery of some client systems';
if (strlen($login_meta) < 100)
$login_meta $login_meta ' / We supply high-end audio that respect music with emotion';

        
$new_meta = <<< EOT
<meta name="description" content="$login_meta" />
EOT;

$current_meta $template_vars['{META}'];
$cat_meta = array('{META}' => $current_meta $new_meta);
return array_merge($template_vars$cat_meta);
}
    }



// Install the plugin
function add_meta_install() {
global $CONFIG$thisplugin;

// add new meta to db
cpg_db_query("INSERT IGNORE INTO {$CONFIG['TABLE_CONFIG']} (`name`, `value`) VALUES ('add_meta_home', 'Home Page Coppermine Photo Gallery')");
cpg_db_query("INSERT IGNORE INTO {$CONFIG['TABLE_CONFIG']} (`name`, `value`) VALUES ('add_meta_alblist', 'Album List Main Page Coppermine Photo Gallery')");
cpg_db_query("INSERT IGNORE INTO {$CONFIG['TABLE_CONFIG']} (`name`, `value`) VALUES ('add_meta_search', 'Search Page Coppermine Photo Gallery')");
cpg_db_query("INSERT IGNORE INTO {$CONFIG['TABLE_CONFIG']} (`name`, `value`) VALUES ('add_meta_pics', 'picture')");
cpg_db_query("INSERT IGNORE INTO {$CONFIG['TABLE_CONFIG']} (`name`, `value`) VALUES ('add_meta_owner_name', '1')");
cpg_db_query("INSERT IGNORE INTO {$CONFIG['TABLE_CONFIG']} (`name`, `value`) VALUES ('add_meta_contact', 'Contact the admin of this Coppermine Photo Gallery')");
cpg_db_query("INSERT IGNORE INTO {$CONFIG['TABLE_CONFIG']} (`name`, `value`) VALUES ('add_meta_register', 'Register an account on this Coppermine Photo Gallery')");
cpg_db_query("INSERT IGNORE INTO {$CONFIG['TABLE_CONFIG']} (`name`, `value`) VALUES ('add_meta_pid', '1')");
cpg_db_query("INSERT IGNORE INTO {$CONFIG['TABLE_CONFIG']} (`name`, `value`) VALUES ('add_meta_login', 'Login to the gallery')");
return true;
}


// Uninstall the plugin
function add_meta_uninstall() {
global $CONFIG$thisplugin;

//remove the record from config
cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'add_meta_home'");
cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'add_meta_alblist'");
cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'add_meta_search'");
cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'add_meta_pics'");
cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'add_meta_owner_name'");
cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'add_meta_contact'");
cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'add_meta_register'");
cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'add_meta_pid'");
cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'add_meta_login'");
return true;
}

function 
jcr_getCurrentUrl() {
    
$superCage Inspekt::makeSuperCage();
    
$protocol $superCage->server->keyExists('HTTPS') && $superCage->server->getAlnum('HTTPS') == 'on'
      
'https://'
      
'http://';
    
$currentUrl $protocol implode($superCage->server->getMatched('HTTP_HOST','/[a-zA-Z0-9\-\.\:]+/')) . implode($superCage->server->getMatched('REQUEST_URI','/[[:print:]]*/'));

    return 
$currentUrl;


?>


Is there a way to config this plugin so that it does NOT add a description tag to albums? I have tweaked things so I can write custom meta tags for description on my site (for album pages (and categories if I can figure that part out)), and it's causing 2 tags to be generated .. I would like to keep this plugin mainly for the image display pages.


Astrasuite - would you mind posting how you did that for the description tag? I'm also getting tons of duplicate description tags on the google and would like to find an easier way to fix it than doing it manually. I played with the themes.inc.php file a bit but couldn't make anything work.

Thanks.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: astrasuite on March 29, 2014, 05:43:47 am
p.s.  It might be very crude to experts :), but it works for me so far ... I only get 1 Google Webmaster HTML Improvement "error", and that's due to Yoast Wordpress plugin.

HTML Improvements
Last updated Mar 27, 2014
Addressing the following may help your site's user experience and performance.
Meta description   Pages
We didn't detect any issues with the meta descriptions on your site.
Title tag   Pages
Missing title tags   1
Duplicate title tags   0
Long title tags   0
Short title tags   0
Non-informative title tags   0
Non-indexable content   Pages
We didn't detect any issues with non-indexable content on your site.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: flapane on October 13, 2014, 11:55:07 pm
Hi,
I've just noticed that it could be interesting to sanitize the description using PHP. Sometimes I use the double quotes in the description, thus breaking the description meta tag.  :)
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: flapane on October 14, 2014, 11:58:30 am
Also, I noticed that no rel=canonical tag is added anywhere. I tried both pid/album+pid options.
There's a typo in the config panel: cannonical instead of canonical.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on October 18, 2014, 02:03:56 am
Also, I noticed that no rel=canonical tag is added anywhere. I tried both pid/album+pid options.
It is only for meta album pictures/pages to tell robots the page is related to the non-meta page.

On this page: http://www.flapane.com/gallery/displayimage.php?album=topn&cat=0&pid=1234#top_display_media
(Top Viewed)

You will find this in the <head>
Quote
<link rel="canonical" href="http://www.flapane.com/gallery/displayimage.php?pid=1234" />


There's a typo in the config panel: cannonical instead of canonical.
Thanks for that and the sanitize suggestion - if time allows for a  next release, they will be included.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: flapane on October 18, 2014, 01:34:33 pm
Thanks for your time.  :)
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: flapane on March 12, 2015, 01:07:00 pm
As for the sanitation thing, maybe it could be useful to other users:
Line 18 of codebase.php
Code: [Select]
function char_convert($str_a) {  // convert some characters if sanitized in db entry
$str_a = str_replace(array('&amp;', '&quot;', '&lt;', '&gt;', '&#039;', '&#39;' , '_' , '-', '"'), array('&', '"', '<', '>', "'", "'", '  ', '  ', '') ,$str_a);
return  $str_a;
}
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: whats_up_skip on April 24, 2015, 05:44:34 am
Joe I just want to thank you for you time and effort with this plugin. You have even produced some quality documentation to go with it. I think it provides some of the much needed SEO for Coppermine Gallery.

Given the work you have done, it would be trivial to add schema data markup to further improve the SEO performance. If you aren't familiar with schema, I can provide the information of what additional markup would be required.

I have wondered about a few other aspects of the display image page that Google might still misinterpret. I know the <H1> and <H3> have been demphasized by Google, but "on page" the Gallery Title name is still the largest text and the gallery description is the first descriptive text on the page. This leaves the picture/media title and description much further down the page, meaning Google is less likely to weight on them. I have wondered if the H1 and largest text should be the picture/media title. Then the H3 is the picture description, with the Gallery description after this. Surely this would improve the uniqueness of the page and emphasis the content better.
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Lon on March 05, 2019, 11:29:22 pm
As for the sanitation thing, maybe it could be useful to other users:
Line 18 of codebase.php
Code: [Select]
function char_convert($str_a) {  // convert some characters if sanitized in db entry
$str_a = str_replace(array('&amp;', '&quot;', '&lt;', '&gt;', '&#039;', '&#39;' , '_' , '-', '"'), array('&', '"', '<', '>', "'", "'", '  ', '  ', '') ,$str_a);
return  $str_a;
}

Is there a reason the title field would still be showing these characters?
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: Joe Carver on March 16, 2019, 08:58:33 pm
Not sure what / how you mean.

Do you have a link / example?
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: tomskafo on April 19, 2019, 07:01:50 pm
Need such a plugin for gallery 1.6
Can anyone help me with this?
Title: Re: Add Description Meta to Gallery <HEAD> and rel=canonical to META pages
Post by: tomskafo on July 18, 2019, 03:53:02 pm
Google and Yandex want a canonical address on each page. Yandex directly writes me: "Canonical address is not specified."
A canonical URL lets you tell search engines that certain similar URLs are actually the same: https://yoast.com/rel-canonical/
How can I indicate the correct canonical link on every page?
Need such a plugin for gallery 1.6