Strict Standards: Declaration of action_plugin_dlcount::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/dlcount/action.php on line 14

Strict Standards: Declaration of action_plugin_indexmenu::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/indexmenu/action.php on line 169

Strict Standards: Declaration of action_plugin_ipban::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/ipban/action.php on line 67

Strict Standards: Declaration of action_plugin_loglog::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/loglog/action.php on line 82

Strict Standards: Declaration of action_plugin_navi::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/navi/action.php on line 46

Strict Standards: Declaration of action_plugin_uparrow::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/uparrow/action.php on line 69

Strict Standards: Declaration of action_plugin_userspagecreate::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/userspagecreate/action.php on line 97

Strict Standards: Declaration of cache_instructions::retrieveCache() should be compatible with cache::retrieveCache($clean = true) in /home/www/wiki/inc/cache.php on line 289

Warning: Cannot modify header information - headers already sent by (output started at /home/www/wiki/lib/plugins/dlcount/action.php:14) in /home/www/wiki/inc/auth.php on line 312

Strict Standards: Only variables should be passed by reference in /home/www/wiki/doku.php on line 71

Warning: Cannot modify header information - headers already sent by (output started at /home/www/wiki/lib/plugins/dlcount/action.php:14) in /home/www/wiki/inc/actions.php on line 154
Sitemap-XML (Google) [phpwcms-HowTo:wiki]

Strict Standards: Declaration of syntax_plugin_code::render() should be compatible with DokuWiki_Syntax_Plugin::render($format, &$renderer, $data) in /home/www/wiki/lib/plugins/code/syntax.php on line 41

Strict Standards: Declaration of syntax_plugin_tip::render() should be compatible with DokuWiki_Syntax_Plugin::render($format, &$renderer, $data) in /home/www/wiki/lib/plugins/tip/syntax.php on line 38

Sitemap-XML (Google)

Kategorielink anstatt Artikellink

Es werden anstatt der Artikellinks die Kategorielinks verwendet. Nur der Kategorielink mit dem aktuellsten Artikeldatum wird verwendet.

Einstellung in “CUSTMOM VAR”: [true|false] [Kategorie-Link | Artikel-link]

Update V1.1: 15.07.2010 KH
- Kleine Korrektur in Zeile 102, da bei “mod_rewrite = 0” die URL nicht eingefügt wurde.

$_link = PHPWCMS_URL.'index.php?'.($cat_link)?$_CAT['acat_alias']:setGetArticleAid( $data );  // +KH

getauscht nach

$_link = PHPWCMS_URL.'index.php?'.(($cat_link)?$_CAT['acat_alias']:setGetArticleAid( $data ));  // +KH


sitemap.php

<?php
/*************************************************************************************
   Copyright notice
 
   (c) 2002-2010 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
 
   This script is part of PHPWCMS. The PHPWCMS web content management system is
   free software; you can redistribute it and/or modify it under the terms of
   the GNU General Public License as published by the Free Software Foundation;
   either version 2 of the License, or (at your option) any later version.
 
   The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
   A copy is found in the textfile GPL.txt and important notices to the license
   from the author is found in LICENSE.txt distributed with these scripts.
 
   This script is distributed in the hope that it will be useful, but WITHOUT ANY
   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
   PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 
   This copyright notice MUST APPEAR in all copies of the script!
*************************************************************************************/
/*
--------------------------------------------------------------------------
+KH 15.06.2010  K.Heermann http://planmatrix.de  Update V1.1 15.07.2010
   Using Category links instead of Article Links
   Switch in CUSTMOM VAR [true|false] [Category-Link | Article-link]
   There is only one category link entry with the most recent Article Date
--------------------------------------------------------------------------
*/
 
// ---------- CUSTOM VAR -------------------------------------------------
$cat_link = true;  // +KH: Using Category links instead of Article Links
// -----------------------------------------------------------------------
 
// build Google Sitemap based on available articles
 
$phpwcms = array();
require_once ('config/phpwcms/conf.inc.php');
 
// set neccessary charset
$phpwcms["charset"] = 'utf-8';
require_once ('include/inc_lib/default.inc.php');
define('VISIBLE_MODE', 0);
require_once (PHPWCMS_ROOT.'/include/inc_lib/dbcon.inc.php');
require_once (PHPWCMS_ROOT.'/config/phpwcms/conf.indexpage.inc.php');
require_once (PHPWCMS_ROOT.'/include/inc_lib/general.inc.php');
require_once (PHPWCMS_ROOT.'/include/inc_front/front.func.inc.php');
 
// start XML
echo '<?xml version="1.0" encoding="utf-8"?>'.LF;
echo '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84
    http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">'.LF;
echo '    <!-- Google Sitemap, http://www.google.com/webmasters/sitemaps/ -->'.LF.LF;
 
 
//reads complete structure as array
$struct    = get_struct_data();
 
 
// fallback value when no article available
$base    = true;
 
 
// now retrieve all articles
$sql  =    "SELECT article_id, article_cid, DATE_FORMAT(article_tstamp, '%Y-%m-%d') AS article_tstamp, ";
$sql .= "article_title, article_redirect, article_aliasid, article_alias ";
$sql .= "FROM ".DB_PREPEND."phpwcms_article WHERE ";
$sql .= "article_public=1 AND article_aktiv=1 AND article_deleted=0 AND article_nosearch!='1' AND ";
$sql .= "article_nositemap=1 AND article_begin < NOW() AND article_end > NOW() ";
$sql .= "ORDER BY article_tstamp DESC";
 
if($result = mysql_query($sql, $db)) {
 
    $temp_entry = array();
 
    while($data = mysql_fetch_assoc($result)) {
 
        // first proof if this article is within an "public" structure section
        $_CAT = $struct[$data['article_cid']];
        if($_CAT['acat_regonly'] || $_CAT['acat_nosearch']=='1' || !$_CAT['acat_nositemap']) {
            // no it is no public article - so jump to next entry
            continue;
        }
 
        // +KH: No double category link if cat_link is active
        //      Only the most recent date is set
        // ----------------------------------------------
        if ($cat_link) {
 
            if (!isset($temp_entry[$_CAT['acat_id']]))
                $temp_entry[$_CAT['acat_id']] = true;
 
            else continue; // +KH: one category link with the most recent date is set
        }
        // ----------------------------------------------
 
        // now add article URL to Google sitemap
        if(empty($phpwcms['rewrite_url']) || empty($data['article_alias'])) {
//            $_link = PHPWCMS_URL.'index.php?'.setGetArticleAid( $data );
            $_link = PHPWCMS_URL.'index.php?'.(($cat_link)?$_CAT['acat_alias']:setGetArticleAid( $data ));  // +KH
        } else {
//            $_link = PHPWCMS_URL.rawurlencode($data['article_alias']).'.phtml';
            $_link = PHPWCMS_URL.rawurlencode(($cat_link)?$_CAT['acat_alias']:$data['article_alias']).'.phtml';  // +KH
        }
        echo '    <url>'.LF;
        echo '        <loc>'.$_link.'</loc>'.LF;
        echo '        <lastmod>'.$data["article_tstamp"].'</lastmod>'.LF;
        echo '    </url>'.LF;
 
        // yes we have a minimum of 1 article link
        $base = false;
 
    }
}
 
 
 
echo LF.'    <!-- try to add custom URLs from INI file... ';
$_addURL = parse_ini_file (PHPWCMS_ROOT.'/config/phpwcms/sitemap.custom.ini', true);
echo '-->'.LF;
 
if(is_array($_addURL) && count($_addURL)) {
 
    foreach($_addURL as $value) {
 
        $_link = empty($value['url']) ? '' : trim($value['url']);
        if(empty($_link)) {
            continue;
        }
        $_lastmod = empty($value['date']) ? '' : trim($value['date']);
        if(empty($value['date'])) {
            $_lastmod = date('Y-m-d');
        }
        echo '    <url>'.LF;
        echo '        <loc>'.$_link.'</loc>'.LF;
        echo '        <lastmod>'.$_lastmod.'</lastmod>'.LF;
        echo '    </url>'.LF;
 
    }
 
} else {
    echo '    <!-- ...no custom URL available for inclusion -->'.LF.LF;
}
 
if($base) {
    // just return the main URL
    echo '    <url>'.LF;
    echo '        <loc>'.PHPWCMS_URL.'</loc>'.LF;
    echo '        <lastmod>'.date('Y-m-d').'</lastmod>'.LF;
    echo '    </url>'.LF;
}
 
echo '</urlset>';
 
?>


Ersetzt index.php?alias mit alias.phtml

Seit r398 im Core implementiert :!:

Forum: http://forum.phpwcms.org/viewtopic.php?p=112317#p112317

Rewrite der Sitemapausgabe mit /sitemap.php für eine sitemap.xml Datei. (index.php?alias → /alias.phtml)

Normalerweise wird das Rewrite des Alias nach alias.phtml von der .htaccess via Apache erledigt.

Patch für sitemap.php: (Funktioniert nur wenn eine Standard-.htaccess verwendet und nach alias.phtml umgeschrieben wird)

Einfügen zwischen:

Beginn:

require_once (PHPWCMS_ROOT.'/include/inc_front/front.func.inc.php');

Einfügen:

// enhanced by k.Heermann (flip-flop) for rewriting to alias.phtml
// --------------------------------------------------------------- +kh 09/01/06
$my_rewrite = false;
if ($phpwcms['rewrite_url'] >= 1  AND  file_exists('.htaccess')) { $my_rewrite = true; }
// ----------------------------------------------------------------

Ende:

// start XML 
echo '<?xml version="1.0" encoding="utf-8"?>'.LF;


und

Ersetzen:

 		$_link = PHPWCMS_URL.'index.php?'.setGetArticleAid( $data );

mit:

		// ---------------------------------------- +kh 09/01/06
		if ($my_rewrite) { $_link = PHPWCMS_URL.setGetArticleAid( $data ).'.phtml'; }
		else { $_link = PHPWCMS_URL.'index.php?'.setGetArticleAid( $data ); }
		// ---------------------------------------- 
 


Multidomain sitemap.php

Erweiterte Version mit festlegbarer Start-ID im Kategoriebaum abhängig vom aktiven Domainnamen.

// Aktuelle Struktur ID -> wo soll es losgehen?
$my_start_id = 22; //default wenn keine Domain angegeben

// Alle Cat-IDs die permanent ausgeschlossen werden sollen z.B. '4,7,34,9'
$_DISABLE_ID = '4,7,34,9'; // Test

// Start-ID zu Domain zuordnen: Entkommentieren und eintragen
$_DOMAIN_ID = array(

//  'domain1.de'   =>  array( 'ID' =>  1 ), 
//  'domain2.com'  =>  array( 'ID' =>  3 ), 
//  'domain3.ch'   =>  array( 'ID' => 11 ), 

);

Verfügbar für alle Personen die brauchbare Beiträge, Übersetzungen oder Videos in das wiki schreiben. (Alternativ kann auch gespendet werden).


deutsch/andere-erweiterungen/sitemap-xml.txt · Last modified: 2010/07/16 07:21 by Knut Heermann (flip-flop)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0

Strict Standards: Only variables should be passed by reference in /home/www/wiki/doku.php on line 79