How to supprime HOME in title ? How to supprime HOME in title ?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

How to supprime HOME in title ?

Started by bg62, January 23, 2017, 11:14:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bg62

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
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

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.
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

bg62

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
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

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)


/******************************************************************************
** 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.
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

bg62

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
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

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
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

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:

/******************************************************************************
** 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.
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

bg62

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:)
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

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.
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

bg62

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
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

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
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

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

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
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

Quote from: bg62 on February 27, 2017, 04: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: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.
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

bg62

Quote from: bg62 on February 28, 2017, 04: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
merci, mais est-il possible de mettre un 'switcher' pour voir plusieurs thèmes en test ?
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

Quote from: gmc on March 01, 2017, 01:32:58 AM
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
;)
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

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  !!!
;)
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 ?

Αndré

Please only post in English outside the language specific support boards. Additionally, please post just one issue per thread. If your issue still exists, please start a new thread. Please choose the correct place regarding the language.