Advanced search  

News:

cpg1.5.46 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter recently discovered vulnerabilities. It is important that all users who run version cpg1.5.44 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: How to supprime HOME in title ?  (Read 6569 times)

0 Members and 1 Guest are viewing this topic.

bg62

  • Coppermine novice
  • *
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 46
  • le 'www' est fait aussi pour communiquer, partager
    • fonds d'écran gratuits
How to supprime HOME in title ?
« on: January 23, 2017, 12:14:28 PM »

Hello,
On the following pages:
- home I have this:
<Title> Home - Site title </ title>
- categories:
<Title> Home> Category Title - Site Title </ title>
 (Not on others = so much better)
How to get this:
- home:
<Title> Site title </ title>
- categories:
<Title> title of the category - Title of the site </ title>
In other words, how to successfully delete the word 'Home' or 'Accueil' in French, which would be much more pleasant for the results in the engines and much better disregarded by Google, 'home' being too generic a word?
Great thanks in advance
Bg
Logged
Mes principaux sites >>> Fonds d'écran / référencer votre site / Longue traîne ... :)     le 'www' est fait aussi pour communiquer, partager et échanger, non ?

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 686
    • GMC Design Photo Gallery
Re: How to supprime HOME in title ?
« Reply #1 on: January 23, 2017, 01:52:31 PM »

The Title is set by function 'theme_page_title' and can be overridden in your theme.
Copy the function from themes/sample/theme.php to your theme's theme.php and customize as you wish.

It currently receives a parm of $section - which it appears contains 'Home' or 'Home - Category', etc...
At the simplest you can strip off the 'Home - ' from the processed variable and return.
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

bg62

  • Coppermine novice
  • *
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 46
  • le 'www' est fait aussi pour communiquer, partager
    • fonds d'écran gratuits
Re: How to supprime HOME in title ?
« Reply #2 on: January 23, 2017, 04:42:26 PM »

Thank you for this answer, it seems obvious ... :)
BUT I'm almost zero in coding and I'm only discovering CPG ...
Despite researching in many themes I did not find 'the' solution.
Could you put the 'piece of code' to add in "theme.php" to get there ?
Thanks to you
Bg
Logged
Mes principaux sites >>> Fonds d'écran / référencer votre site / Longue traîne ... :)     le 'www' est fait aussi pour communiquer, partager et échanger, non ?

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 686
    • GMC Design Photo Gallery
Re: How to supprime HOME in title ?
« Reply #3 on: January 23, 2017, 05:51:25 PM »

You can try this... Tested briefly in my sandbox. Only added a single line to the provided sample - marked below by //*GMC.
Copy the following to the bottom of your themename/theme.php file
(assumes you do not already have this function in your theme.php)

Code: [Select]
/******************************************************************************
** Section <<<theme_page_title>>> - START
******************************************************************************/
// Creates the title tag for each page
// For the sake of search engine friendliness, the dynamic part $section should come first
function theme_page_title($section)
{
    global $CONFIG;
    $return = strip_tags(bb_decode($section)) . ' - ' . $CONFIG['gallery_name'];
    $return = str_replace('Home - ', '', $return);    //*GMC remove 'Home - ' from Title - forum thread 78963...
    return $return;
}
/******************************************************************************
** Section <<<theme_page_title>>> - END
******************************************************************************/

The above only changes the page TITLE - shown in the browser tab.  The 'breadcrumb' links (below main menu) still includes Home as an easy way for use to return to homepage.
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

bg62

  • Coppermine novice
  • *
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 46
  • le 'www' est fait aussi pour communiquer, partager
    • fonds d'écran gratuits
Re: How to supprime HOME in title ?
« Reply #4 on: January 23, 2017, 06:57:10 PM »

Thank you I just test, but that does not change anything ....
Here is the total theme.php file that I have for now, IF you find an error :)
Grans thanks
Bg
Logged
Mes principaux sites >>> Fonds d'écran / référencer votre site / Longue traîne ... :)     le 'www' est fait aussi pour communiquer, partager et échanger, non ?

bg62

  • Coppermine novice
  • *
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 46
  • le 'www' est fait aussi pour communiquer, partager
    • fonds d'écran gratuits
Re: How to supprime HOME in title ?
« Reply #5 on: January 24, 2017, 08:04:40 PM »

Ok it works, I did not have the function in theme.php
And I also amended:
$ Return = str_replace ('Accueil -', '', $ return); // * GMC remove 'Home -' from Title - forum thread 78963 ...
Since the site is in French :)
Now I still have the same problem with categories:
<Title> Home> category - title </ title>
How to have only this:
<Title> category - title </ title>
Friendships
Bg
Logged
Mes principaux sites >>> Fonds d'écran / référencer votre site / Longue traîne ... :)     le 'www' est fait aussi pour communiquer, partager et échanger, non ?

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 686
    • GMC Design Photo Gallery
Re: How to supprime HOME in title ?
« Reply #6 on: January 24, 2017, 10:12:40 PM »

I tested it at the overall and album level... and those worked... hadn't checked categories...
For some reason categories use a > instead of a -... missed that difference...
Also altered to respect the language choice (added $lang_main_menu to GLOBAL statement and referenced 'home_lnk' to get proper language for 'Home'...

Replace function with:
Code: [Select]
/******************************************************************************
** Section <<<theme_page_title>>> - START
******************************************************************************/
// Creates the title tag for each page
// For the sake of search engine friendliness, the dynamic part $section should come first
function theme_page_title($section)
{
    global $CONFIG, $lang_main_menu;                                                            //* GMC added access to $lang_main_menu
    $return = strip_tags(bb_decode($section)) . ' - ' . $CONFIG['gallery_name'];
    $return = str_replace(array("{$lang_main_menu['home_lnk']} - ", "{$lang_main_menu['home_lnk']} > "), '', $return); //* GMC remove 'Home -' from Title - forum thread 78963 ...
    return $return;
}
/******************************************************************************
** Section <<<theme_page_title>>> - END
******************************************************************************/

Note I also have a space AFTER the '-' and now the '>' as well to not have the title begin with a space... That was in my original - but not in your reply.
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

bg62

  • Coppermine novice
  • *
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 46
  • le 'www' est fait aussi pour communiquer, partager
    • fonds d'écran gratuits
Re: How to supprime HOME in title ?
« Reply #7 on: January 25, 2017, 12:14:48 PM »

Great !!!
It is good to know the coding!
EVERYTHING seems to work fine, I will continue to test to see, but this solution suits me.
At nievau SEO and SEO it's already a very big point that all GC users should adopt!
If I can say 'thank you' on my side, I can put you a return link if you wish;)
Hat down and thank you again
  !
Bg
+1000:)
Logged
Mes principaux sites >>> Fonds d'écran / référencer votre site / Longue traîne ... :)     le 'www' est fait aussi pour communiquer, partager et échanger, non ?

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 686
    • GMC Design Photo Gallery
Re: How to supprime HOME in title ?
« Reply #8 on: January 25, 2017, 01:36:13 PM »

You're welcome... Glad its working as you want.

We always welcome links to Coppermine - especially maintaining the 'Powered by Coppermine' link on any gallery using the software.
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

bg62

  • Coppermine novice
  • *
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 46
  • le 'www' est fait aussi pour communiquer, partager
    • fonds d'écran gratuits
Re: How to supprime HOME in title ?
« Reply #9 on: January 25, 2017, 04:01:40 PM »

Thanks for all this;)
I'm just learning how to use GICs, despite the little programming knowledge I have, with a few tries, especially trying to get maximum optimization at the SEO level, Will really put the site online.
For now the 'draft' is here, if you can give me some opinions, they will be welcome.
http://refok.fr/wall/
Very soon, on another question perhaps ...
Bg
Logged
Mes principaux sites >>> Fonds d'écran / référencer votre site / Longue traîne ... :)     le 'www' est fait aussi pour communiquer, partager et échanger, non ?

bg62

  • Coppermine novice
  • *
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 46
  • le 'www' est fait aussi pour communiquer, partager
    • fonds d'écran gratuits
Re: How to supprime HOME in title ?
« Reply #10 on: February 27, 2017, 05:28:52 PM »

Hello and SOS !!!!
I had to make a fake manipulation and dece made the theme no longer works at all !!!
Nothing appears and I get this:
Quote
Fatal error: Can not redeclare theme_page_title () (previously declared in /homepages/22/d531682963/htdocs/refok/wall/themes/open3/theme.php:4314) in / homepages / 22 / d531682963 / htdocs / refok / wall / themes /open3/theme.php on line 4408
I put the zip in attachment
All is blocked and I can not find ... if "GMC" could once again help me = great thanks ...
Bg
Logged
Mes principaux sites >>> Fonds d'écran / référencer votre site / Longue traîne ... :)     le 'www' est fait aussi pour communiquer, partager et échanger, non ?

Joe Carver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1497
  • aka 'i-imagine'
    • Home Page
Re: How to supprime HOME in title ?
« Reply #11 on: February 28, 2017, 02:39:09 PM »

To get back into your site use:
Yoursitename.index.php?theme=xxx

This will open it.

Use a working theme as the default while you test changes: yoursitename.index.php?theme=newtheme

Then set as default after testing.
(Check the docs for setting themes)

bg62

  • Coppermine novice
  • *
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 46
  • le 'www' est fait aussi pour communiquer, partager
    • fonds d'écran gratuits
Re: How to supprime HOME in title ?
« Reply #12 on: February 28, 2017, 05:53:28 PM »

Ok for this information, but is it possible to set up a "switcher" so that people can see and ters?
I would like to finish this theme and share it :)
thank you
Bg
Logged
Mes principaux sites >>> Fonds d'écran / référencer votre site / Longue traîne ... :)     le 'www' est fait aussi pour communiquer, partager et échanger, non ?

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 686
    • GMC Design Photo Gallery
Re: How to supprime HOME in title ?
« Reply #13 on: March 01, 2017, 02:32:58 AM »

Hello and SOS !!!!
I had to make a fake manipulation and dece made the theme no longer works at all !!!
Nothing appears and I get this:I put the zip in attachment
All is blocked and I can not find ... if "GMC" could once again help me = great thanks ...
Bg
GMC was 'on the road'... Did you fix your problem?
Looking at the theme.php - you have function theme_page_title defined twice - exactly what the error is telling you.
It is on lines 4314-4321, and on lines 4402-4408.

I think you want to remove the first occurrence - the second is the latest I provided that used the language variable to get the current language version of 'home' to replace.
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

bg62

  • Coppermine novice
  • *
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 46
  • le 'www' est fait aussi pour communiquer, partager
    • fonds d'écran gratuits
Re: How to supprime HOME in title ?
« Reply #14 on: March 01, 2017, 12:13:57 PM »

Ok for this information, but is it possible to set up a "switcher" so that people can see and ters?
I would like to finish this theme and share it :)
thank you
Bg
merci, mais est-il possible de mettre un 'switcher' pour voir plusieurs thèmes en test ?
Logged
Mes principaux sites >>> Fonds d'écran / référencer votre site / Longue traîne ... :)     le 'www' est fait aussi pour communiquer, partager et échanger, non ?

bg62

  • Coppermine novice
  • *
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 46
  • le 'www' est fait aussi pour communiquer, partager
    • fonds d'écran gratuits
Re: Re: How to supprime HOME in title ?
« Reply #15 on: March 01, 2017, 12:20:38 PM »

GMC was 'on the road'... Did you fix your problem?
Looking at the theme.php - you have function theme_page_title defined twice - exactly what the error is telling you.
It is on lines 4314-4321, and on lines 4402-4408.

I think you want to remove the first occurrence - the second is the latest I provided that used the language variable to get the current language version of 'home' to replace.
YES !!! You are the best = correction  = OK
i have modified all the theme.hp, zip attached :)
Here is what I currently display in the 'Title' tag:
- on the home: <title>Les Images sur le mur</title> = OK
- on a category (automobiles): <title>Automobiles - Les Images sur le mur</title> = OK
- on an album of the same category (automobiles > Ford Mustang): <title>Ford Mustang - Les Images sur le mur</title> = NO!
Could we have:
<title>Automobile - Ford Mustang - Les Images sur le mur</title>
or ....
<title>Ford Mustang - Automobile - Les Images sur le mur</title>
???
There I do not know at all what code to alter .... but I think you should get there:
Friendships
Bg

( le site est en test ici : http://refok.fr/wall/index.php
 ;)
Logged
Mes principaux sites >>> Fonds d'écran / référencer votre site / Longue traîne ... :)     le 'www' est fait aussi pour communiquer, partager et échanger, non ?

bg62

  • Coppermine novice
  • *
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 46
  • le 'www' est fait aussi pour communiquer, partager
    • fonds d'écran gratuits
Re: How to supprime HOME in title ?
« Reply #16 on: March 16, 2017, 12:18:08 PM »

je réponds et cherche de nouveau, en francçais, désolé ...

1 - sur la 'home' j'ai ceci :
<title>Les Images sur le mur</title>
= OK
2 -  sur une catégorie j'ai ceci :
<title>Automobiles - Les Images sur le mur</title>
= OK
3 - pour une 'image' j'ai ceci :
<title>Ford Mustang - Ford Mustang Cabriolet - Les Images sur le mur</title>
== OK
4 - sur un album j'ai ceci :
<title>Ford Mustang - Les Images sur le mur</title>
= NON

J'aurais voulu avoir cela :
<title>Automobiles - Ford Mustang - Les Images sur le mur</title>
autrement dit :
catégories > album > titre général



Peut-être faut-il corriger ceci ???

/******************************************************************************
** Section <<<theme_page_title>>> - START
******************************************************************************/
// Creates the title tag for each page
// For the sake of search engine friendliness, the dynamic part $section should come first
function theme_page_title($section)
{
    global $CONFIG, $lang_main_menu;                                                            //* GMC added access to $lang_main_menu
    $return = strip_tags(bb_decode($section)) . ' - ' . $CONFIG['gallery_name'];
    $return = str_replace(array("{$lang_main_menu['home_lnk']} - ", "{$lang_main_menu['home_lnk']} > "), '', $return); //* GMC remove 'Home -' from Title - forum thread 78963 ...
    return $return;
}
/******************************************************************************
** Section <<<theme_page_title>>> - END
******************************************************************************/

mais là ça me dépasse ... :
fichier theme.php ( en zip ) joint ET MERCI POUR TOUTE VOTE AIDE  !!!
;)
Logged
Mes principaux sites >>> Fonds d'écran / référencer votre site / Longue traîne ... :)     le 'www' est fait aussi pour communiquer, partager et échanger, non ?
Pages: [1]   Go Up
 

Page created in 0.081 seconds with 20 queries.