1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

Fix for gsitemap SEF URL Aliases

This commit is contained in:
Cameron 2022-03-04 09:22:36 -08:00
parent c889d666b9
commit 3592c5ae30
2 changed files with 12 additions and 10 deletions

View File

@ -36,8 +36,8 @@ class gsitemap_url // plugin-folder + '_url'
$config['xml'] = array( $config['xml'] = array(
'alias' => 'sitemap', 'alias' => 'sitemap',
'regex' => '^sitemap\.xml$', // matched against url, and if true, redirected to 'redirect' below. 'regex' => '^{alias}\.xml$', // matched against url, and if true, redirected to 'redirect' below.
'sef' => 'sitemap.xml', // used by e107::url(); to create a url from the db table. 'sef' => '{alias}.xml', // used by e107::url(); to create a url from the db table.
'redirect' => '{e_BASE}gsitemap.php', // file-path of what to load when the regex returns true. 'redirect' => '{e_BASE}gsitemap.php', // file-path of what to load when the regex returns true.
); );
@ -48,14 +48,16 @@ class gsitemap_url // plugin-folder + '_url'
{ {
foreach($item as $data ) foreach($item as $data )
{ {
$key = $plug.'-'.$data['sef']; // eg. news-latest $key = $plug.'-'.$data['sef']; // eg. news-posts
$config[$key] = array( $config[$key] = array(
'alias' => $key, 'alias' => $key.'-sitemap',
'regex' => '^'.$key.'-sitemap\.xml$', // matched against url, and if true, redirected to 'redirect' below. 'regex' => '^{alias}\.xml$', // matched against url, and if true, redirected to 'redirect' below.
'sef' => $key.'-sitemap.xml', // used by e107::url(); to create a url from the db table. 'sef' => '{alias}.xml', // used by e107::url(); to create a url from the db table.
'redirect' => '{e_BASE}gsitemap.php?plug='.$plug.'&func='.$data['function'], // file-path of what to load when the regex returns true. 'redirect' => '{e_BASE}gsitemap.php?plug='.$plug.'&func='.$data['function'], // file-path of what to load when the regex returns true.
); );
// var_dump($config);
} }
} }

View File

@ -28,9 +28,9 @@ class news_gsitemap
// Viewable from my-website.com/news-latest-sitemap.xml ie. plugin-folder + function + 'sitemap.xml' // Viewable from my-website.com/news-latest-sitemap.xml ie. plugin-folder + function + 'sitemap.xml'
$config[] = array( $config[] = array(
'name' => "Latest News Posts", 'name' => "All News Posts",
'function' => "latestPosts", 'function' => "allPosts",
'sef' => 'latest', // used in URL. eg. news-latest-sitemap.xml 'sef' => 'posts', // used in URL. eg. news-posts-sitemap.xml @see e107_plugins/gsitemap/e_url.php L45
); );
return $config; return $config;
@ -97,7 +97,7 @@ class news_gsitemap
/* Custom Function for dynamic sitemap of news posts */ /* Custom Function for dynamic sitemap of news posts */
public function latestPosts() public function allPosts()
{ {
$data = $this->getNewsPosts(); $data = $this->getNewsPosts();