a.conev
New Member
Може ли да ми препоръчате софт. за xml сайтмап за форума. И също така мислите ли че правлино съм оптимизирал с URL-тата ми. Не излиза в търсачки като трябва
www.businessmind.eu
www.businessmind.eu
<?php
/***************************************************************************
* googlesitemapgenerator.php
* -------------------
* Copyright/Support http://www.pentapenguin.com
* Last Modified: 06/05/05
*
***************************************************************************/
/***************************************************************************
*
* This program 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.
*
***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . "common.$phpEx");
// Begin Configuration Section
$included_forum_ids = array();
$excluded_forum_ids = array();
// End Configuration Section
if ( count($included_forum_ids) > 0 )
{
$included_forum_ids_sql = 'forum_id IN (' . implode(', ', $included_forum_ids) . ')';
}
if ( count($excluded_forum_ids) > 0 )
{
$excluded_forum_ids_sql = 'forum_id NOT IN (' . implode(', ', $excluded_forum_ids) . ')';
}
if ( ( count($included_forum_ids) > 0 ) && ( count($excluded_forum_ids) > 0 ) )
{
$and = 'AND';
}
if ( ( count($included_forum_ids) > 0 ) || ( count($excluded_forum_ids) > 0 ) )
{
$where = 'WHERE';
}
$sql = "SELECT topic_id, forum_id, topic_time, topic_type FROM " . TOPICS_TABLE . " $where $included_forum_ids_sql $and $excluded_forum_ids_sql ORDER BY topic_time DESC";
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Error: could not retrive topic IDs', '', __LINE__, __FILE__, $sql);
}
$protocol = ( $board_config['cookie_secure'] == 0 ) ? 'http://www.' : 'https://www.';
$servername = $board_config['server_name'];
$port = ( $board_config['server_port'] == '80' ) ? '' : ':' . $board_config['server_port'];
$path = $board_config['script_path'];
$output = '<' . '?xml version="1.0" encoding="UTF-8"?' . '>' . "\n";
$output .= '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">' . "\n";
while ( $row = $db->sql_fetchrow($result) )
{
$topic_id = $row['topic_id'];
$forum_id = $row['forum_id'];
$lastmodified = date('Y-m-d\TH:i:s+02:00', $row['topic_time']);
$viewtopic = "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id";
$priority = ( $row['topic_type'] == POST_STICKY || $row['topic_type'] == POST_ANNOUNCE ) ? '1.0' : '0.5';
$output .= "<url>\n";
$output .= "\t<loc>$protocol$servername$port$path$viewtopic" . "</loc>\n";
$output .= "\t<lastmod>$lastmodified</lastmod>\n";
$output .= "\t<changefreq>daily</changefreq>\n";
$output .= "\t<priority>$priority</priority>\n";
$output .= "</url>\n\n";
}
$output .= "</urlset>\n";
header('Content-type: application/xml');
echo $output;
?>
Така сега да видим дали съм разбрал.
В момента използвам Sitemap.txt с ръчно изброяване на категориите на нов ред (най-примитивният използван метод)
Четох че има възможност да се използва .xml Sitemap
Сега разбирам че има Sitemap.php
Пействам в текстов едитор кода по - горе и добавям забранените директории и това ми замества сайтмап така ли?
И после поставям този файл в директорията с индекса.хтм ?
index.php?c=xx => cat-title-cxx.html
viewforum.php?t=xx => forum-title-fxx.html
viewforum.php?t=xx&start=xx => forum-title-fxx-yy.html
viewtopic.php?t=xx => topic-title-txx.html
viewtopic.php?t=xx&start=xx => topic-title-txx-yy.html
viewtopic.php?p=xx => postxx.html
profile.php?mode=viewprofile&u=xx => memberxx.html
Така създадената сайтмап има ли нужда да се ъпдейтва при писане във форума или е автоматично актуализираща се?
ето кода правиш един фаил сайтмап пхп в главната директория и слагаш този срипт ако имаш затворени секции на форума ги добавяш в $excluded_forum_ids = array(); разделени с ,
PHP:<?php /*************************************************************************** * googlesitemapgenerator.php * ------------------- * Copyright/Support http://www.pentapenguin.com * Last Modified: 06/05/05 * ***************************************************************************/ /*************************************************************************** * * This program 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. * ***************************************************************************/ define('IN_PHPBB', true); $phpbb_root_path = './'; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . "common.$phpEx"); // Begin Configuration Section $included_forum_ids = array(); $excluded_forum_ids = array(); // End Configuration Section if ( count($included_forum_ids) > 0 ) { $included_forum_ids_sql = 'forum_id IN (' . implode(', ', $included_forum_ids) . ')'; } if ( count($excluded_forum_ids) > 0 ) { $excluded_forum_ids_sql = 'forum_id NOT IN (' . implode(', ', $excluded_forum_ids) . ')'; } if ( ( count($included_forum_ids) > 0 ) && ( count($excluded_forum_ids) > 0 ) ) { $and = 'AND'; } if ( ( count($included_forum_ids) > 0 ) || ( count($excluded_forum_ids) > 0 ) ) { $where = 'WHERE'; } $sql = "SELECT topic_id, forum_id, topic_time, topic_type FROM " . TOPICS_TABLE . " $where $included_forum_ids_sql $and $excluded_forum_ids_sql ORDER BY topic_time DESC"; if ( !$result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Error: could not retrive topic IDs', '', __LINE__, __FILE__, $sql); } $protocol = ( $board_config['cookie_secure'] == 0 ) ? 'http://www.' : 'https://www.'; $servername = $board_config['server_name']; $port = ( $board_config['server_port'] == '80' ) ? '' : ':' . $board_config['server_port']; $path = $board_config['script_path']; $output = '<' . '?xml version="1.0" encoding="UTF-8"?' . '>' . "\n"; $output .= '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">' . "\n"; while ( $row = $db->sql_fetchrow($result) ) { $topic_id = $row['topic_id']; $forum_id = $row['forum_id']; $lastmodified = date('Y-m-d\TH:i:s+02:00', $row['topic_time']); $viewtopic = "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id"; $priority = ( $row['topic_type'] == POST_STICKY || $row['topic_type'] == POST_ANNOUNCE ) ? '1.0' : '0.5'; $output .= "<url>\n"; $output .= "\t<loc>$protocol$servername$port$path$viewtopic" . "</loc>\n"; $output .= "\t<lastmod>$lastmodified</lastmod>\n"; $output .= "\t<changefreq>daily</changefreq>\n"; $output .= "\t<priority>$priority</priority>\n"; $output .= "</url>\n\n"; } $output .= "</urlset>\n"; header('Content-type: application/xml'); echo $output; ?>
Зверски неудобно за динамични сайтове.това ще е полезно на много хора - прави карта и я сваляш за 3-4 секунди си готов
http://makeasitemap.com/
#!/bin/bash
if [ "$1" = "" ]; then
echo "Не е уточнен адресът на форума."
exit 1
else
my_top_url="$1"
echo "Адресът на форума е „$my_top_url“"
fi
if [ "$2" = "" ]; then
echo "Не е уточнено къде ще се записва картата. Допускаме, че това е sitemap.xml в текущата директория."
sitemap_xml="sitemap.xml"
else
sitemap_xml="$2"
fi
echo "Картата ще се запише във файла $sitemap_xml"
if [ "$3" = "" ]; then
echo "Не е уточен началния номер на съобщение. Допускаме, че това е номер 1."
first_topic=1
else
first_topic="$3"
fi
if [ "$4" = "" ]; then
echo "Не е уточен последния номер на съобщение. Допускаме, че това е номер 10."
last_topic=10
else
last_topic="$4"
fi
rm -f "$sitemap_xml"
cat >> "$sitemap_xml" << EOF
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
EOF
cat >> "$sitemap_xml" << EOF
<url><loc>${my_top_url}</loc></url>
EOF
seq $first_topic $last_topic | while read cntr; do
cat >> "$sitemap_xml" << EOF
<url><loc>${my_top_url}viewtopic.php?t=${cntr}</loc></url>
EOF
done
cat >> "$sitemap_xml" << EOF
</urlset>
EOF
valentin@darkstar:~$ make_forum_sitemap.bash http://myforum.com/
Адресът на форума е „http://myforum.com/“
Не е уточнено къде ще се записва картата. Допускаме, че това е sitemap.xml в текущата директория.
Картата ще се запише във файла sitemap.xml
Не е уточен началния номер на съобщение. Допускаме, че това е номер 1.
Не е уточен последния номер на съобщение. Допускаме, че това е номер 10.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url><loc>http://myforum.com/</loc></url>
<url><loc>http://myforum.com/viewtopic.php?t=1</loc></url>
<url><loc>http://myforum.com/viewtopic.php?t=2</loc></url>
<url><loc>http://myforum.com/viewtopic.php?t=3</loc></url>
<url><loc>http://myforum.com/viewtopic.php?t=4</loc></url>
<url><loc>http://myforum.com/viewtopic.php?t=5</loc></url>
<url><loc>http://myforum.com/viewtopic.php?t=6</loc></url>
<url><loc>http://myforum.com/viewtopic.php?t=7</loc></url>
<url><loc>http://myforum.com/viewtopic.php?t=8</loc></url>
<url><loc>http://myforum.com/viewtopic.php?t=9</loc></url>
<url><loc>http://myforum.com/viewtopic.php?t=10</loc></url>
</urlset>