Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4219
Latest: Toddie
New This Month: 0
New This Week: 0
New Today: 0
Stats
Total Posts: 42850
Total Topics: 7463
Most Online Today: 96
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 64
Total: 64

Author Topic: Pretty Urls SEO Pro  (Read 217 times)

0 Members and 1 Guest are viewing this topic.

Offline Toddie

  • Pretty Urls SEO Pro
  • Member
  • *****
  • Posts: 1
    • View Profile
Pretty Urls SEO Pro
« on: May 06, 2023, 05:13:22 am »
I would like to save the sitemap (automatically) daily in the root directory as sitemap.xml.
Does anyone have an idea how I could do that?


Thank you!
« Last Edit: May 06, 2023, 05:30:05 am by Toddie »

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16256
    • View Profile
Re: Pretty Urls SEO Pro
« Reply #1 on: May 06, 2023, 03:30:11 pm »
You would need to make changes.
Open themes/default/PrettyUrls.template.php
Find the function function template_pretty_xml_sitemap() and the code inside and replace with
Code: [Select]
function template_pretty_xml_sitemap()
{
global $context, $scripturl, $boarddir;

$data = '';

$data .= '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
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">
<url>
<loc>' . fix_possible_url($scripturl) . '</loc>
<lastmod>' . $context['sitemap']['main']['time'] . '</lastmod>
<changefreq>always</changefreq>
<priority>1.0</priority>
</url>';

foreach ($context['sitemap']['items'] as $item)
$data .= '
<url>
<loc>' . $item['url'] . '</loc>
<lastmod>' . $item['time'] . '</lastmod>
<changefreq>' . (empty($item['changefreq']) ? 'daily' : $item['changefreq']) . '</changefreq>
<priority>' . $item['priority'] . '</priority>
</url>';

$data .= '
</urlset>';

echo $data;

file_put_contents($boarddir .'/sitemap.xml');
}

Then you can setup a task or cronjob to call
sitenamecom/index.php?action=sitemaps&xml=1
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

 

Related Topics

  Subject / Started by Replies Last post
4 Replies
5203 Views
Last post September 11, 2010, 06:21:10 am
by Wickedgood
6 Replies
6797 Views
Last post July 15, 2018, 04:14:19 pm
by SMFHacks
7 Replies
3119 Views
Last post March 07, 2019, 11:23:09 pm
by SMFHacks
16 Replies
1096 Views
Last post December 27, 2022, 05:32:14 pm
by [chrisB]
11 Replies
1153 Views
Last post February 01, 2023, 05:18:47 pm
by [chrisB]

+- Recent Topics

Question on Completed Listing & Reserve Price by SMFHacks
May 31, 2023, 01:43:19 pm

[Mod]GDPR Helper by Nicole
May 29, 2023, 11:58:49 pm

RSS Feed Poster Database Error by SMFHacks
May 22, 2023, 06:26:18 pm

Errors With Older Version. by Ken.
May 09, 2023, 05:35:40 pm

Pretty Urls SEO Pro by SMFHacks
May 06, 2023, 03:30:11 pm

New Post Image Upload Error by Mike66
April 28, 2023, 07:30:28 am

Copyright Removal Key by SMFHacks
April 03, 2023, 02:44:28 pm

Converting from Aeva Media by sudhakar
April 02, 2023, 11:09:54 am

Using SMF's Built-in Search Algorithm by shuban
March 27, 2023, 09:15:10 am

Permissions query by davejo
March 26, 2023, 04:43:48 am

Powered by EzPortal