Announcement

#1 2013-06-06 16:35:21

hkdigit
Translation Team
Hong Kong
2013-05-23
89

Page Title metatag format

How to change the page title format.

From the demo gallery, I find the it use "|" as separate

<title>America | Demo | Piwigo.org</title>

Where my gallery using "/"

<title>香港體育運動照片 / 香港馬拉松相片 / 香港馬拉松2013相片 | 香港圖片庫</title>

Also, how the change the order of Album Name, Category Name and Gallery Name?

Piwigo 2.5.1

Offline

 

#2 2013-06-06 17:08:37

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
7207

Re: Page Title metatag format

Hi :-)

You can use [extension by ddtddt] Title
or make template modele file header.tpl
line 17
remplace
<title>{if $PAGE_TITLE!=l10n('Home') && $PAGE_TITLE!=$GALLERY_TITLE}{$PAGE_TITLE} | {/if}{$GALLERY_TITLE}</title>

by

<title>{if $PAGE_TITLE!=l10n('Home') && $PAGE_TITLE!=$GALLERY_TITLE}{$PAGE_TITLE} / {/if}{$GALLERY_TITLE}</title>


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#3 2013-06-07 15:53:01

hkdigit
Translation Team
Hong Kong
2013-05-23
89

Re: Page Title metatag format

Thanks, but any docs to show how to use Title plugin?

Does it support only support constant text? Any system variable supported?

Offline

 

#4 2013-06-07 16:57:51

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
7207

Re: Page Title metatag format

Hi :-)

With plugin title, you can change title for all photo, album, page contact, page additional, and special page

What would you want on title tag ?


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#5 2013-06-07 17:36:11

hkdigit
Translation Team
Hong Kong
2013-05-23
89

Re: Page Title metatag format

For Album Pages, I want to use following syntax.

%Sub Album Name% -  %Gallery Name%

For Photo Pages:

%photo title% - %Sub Album Name% -  %Gallery Name%

Is it possible?

Offline

 

#6 2013-06-07 17:42:44

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
7207

Re: Page Title metatag format

hkdigit wrote:

For Album Pages, I want to use following syntax.

%Sub Album Name% -  %Gallery Name%

For Photo Pages:

%photo title% - %Sub Album Name% -  %Gallery Name%

Is it possible?

Yes is possible with a new plugin


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#7 2013-06-07 17:44:09

hkdigit
Translation Team
Hong Kong
2013-05-23
89

Re: Page Title metatag format

When the *new* plugin will release?

Offline

 

#8 2013-06-07 19:31:27

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
7207

Re: Page Title metatag format

Hi :-)

You can test to personal plugin

<?php
/*
Plugin Name: Titlehkdigit
Version: auto
Description:
Plugin URI: http://piwigo.org/ext/extension_view.php?eid=
Author: ddtddt
Author URI: http://piwigo.org/
*/

if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');

global $prefixeTable, $template;

define('TITLEHK_DIR' , basename(dirname(__FILE__)));
define('TITLEHK_PATH' , PHPWG_PLUGINS_PATH . TITLEHK_DIR . '/');


//prefiltre for change <title>
add_event_handler('loc_begin_page_header', 'plug_Titlehk', 56 );

function plug_Titlehk()
{
    global $template;
    $template->set_prefilter('header', 'plug_TitlehkP');
   
    $PAED = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ExtendedDescription';"));
    if($PAED['state'] == 'active') add_event_handler('AP_render_content', 'get_user_language_desc');
}

function plug_TitlehkP($content, &$smarty)
{
  $search = '#<title>.*?</title>#';
 
  $replacement = '<title>{$PERSO_TITLEHK}</title>
  ';

  return preg_replace($search, $replacement, $content);
}


// no empty !
add_event_handler('loc_begin_page_header', 'plugTitlehk', 61);
function plugTitlehk()
{
    global $template, $conf;
   
    $titlehk = & $conf['gallery_title'];
         if (!empty($titlehk))
            {               
                $template->assign('PERSO_TITLEHK', $titlehk);
            }
}


//use title on photo page
add_event_handler('loc_begin_page_header', 'TitlehkPhoto', 76 );
function TitlehkPhoto()
{
        global $template, $page, $conf;

              if ( !empty($page['image_id']) )   
                {
                 $query = '
select id,name
  FROM ' . IMAGES_TABLE . '
  WHERE id = \''.$page['image_id'].'\'
  ;';
$result = pwg_query($query);
$row = pwg_db_fetch_assoc($result);
$titlehk1=$row['name'];

    $query = '
select id,name
  FROM ' . CATEGORIES_TABLE . '
  WHERE id = \''.$page['category']['id'].'\'
  ;';
$result = pwg_query($query);
$row = pwg_db_fetch_assoc($result);
$titlehk2=$row['name'];           

$titlehk3 = & $conf['gallery_title'];   

    $titlehkP = $titlehk1 ." - ". $titlehk2 . " - " . $titlehk3;

$titlehkPED=trigger_event('AP_render_content', $titlehkP);
   
        if (!empty($titlehkPED))
            {
                $template->assign('PERSO_TITLEHK', $titlehkPED);
            }
                }
}

// use title on album page
add_event_handler('loc_begin_page_header', 'Titlehkalbum', 71 );
function Titlehkalbum()
{
    global $template, $page, $conf;
         if (!empty($page['category']['id']) )   
                {
    $query = '
select id,name
  FROM ' . CATEGORIES_TABLE . '
  WHERE id = \''.$page['category']['id'].'\'
  ;';
$result = pwg_query($query);
$row = pwg_db_fetch_assoc($result);
$titlehk2=$row['name'];       
    $titlehk3 = & $conf['gallery_title'];   
   
    $titlehkA = $titlehk2 . " - " . $titlehk3 ;
$titlehkAED=trigger_event('AP_render_content', $titlehkA);

        if (!empty($titlehkAED))
            {
                $template->assign('PERSO_TITLEHK', $titlehkAED);
            }
                }
}

?>


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#9 2013-06-10 04:49:17

hkdigit
Translation Team
Hong Kong
2013-05-23
89

Re: Page Title metatag format

ddtddt, Great Thanks!

However, I don't know how to use it.

Just save the file as Titlehkdigit.php and upload to /plugins folder? Please kindly advise.

Offline

 

#10 2013-06-10 06:10:27

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
7207

Re: Page Title metatag format

Hi :-)

Go to Administration -> Plugins -> Manage
activate [extension by Piwigo Team] LocalFiles Editor

Go to Administration -> Plugin -> Local File editor -> Tab 'personal plugin'

Paste code

Go to administration ->  Plugins -> Manage
activate personal plugin


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#11 2013-08-30 09:38:20

hkdigit
Translation Team
Hong Kong
2013-05-23
89

Re: Page Title metatag format

Hi ddtddt,

Will the personal plugin available to public (i.e. Can down and install inside Piwigo). As I am try to deploy several copy of Piwigo and afraid to mess up by updating the Local File.

Many thanks in advance.

Offline

 

#12 2013-08-30 18:38:41

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
7207

Re: Page Title metatag format

Hi :-)

You can create a plugin and add by FTP ;-)


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#13 2013-09-02 10:07:17

hkdigit
Translation Team
Hong Kong
2013-05-23
89

Re: Page Title metatag format

I am not smart as you, can you tell me more details... or official publish to public under your professional support ;^)

Offline

 

#14 2013-09-07 11:33:39

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
7207

Re: Page Title metatag format

Hi :-)

By FTP download folder 'PersonalPlugin' (in plugins) on you computer

Rename by Titlehkdigit

edit file main.inc.php
Rename PersonalPlugin by Titlehkdigit

you can add you plugin in folder plugins on other piwigo and active


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#15 2013-09-13 05:45:15

hkdigit
Translation Team
Hong Kong
2013-05-23
89

Re: Page Title metatag format

Hi, ddtddt

Thanks! It's working!

Merci beaucoup. :)

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact