emanuele45 / prettyurls

Automatically exported from code.google.com/p/prettyurls
Other
0 stars 0 forks source link

to parse (and rewrite) sitemap links as well #56

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. if the request contains a sitemap xml file (instead of normal html tags)
it doesn't parse it 

What is the expected output? What do you see instead?
applying pretty urls to a sitemap as well 

What version of the mod, and what version of SMF are you using?
0.9.1

What other mods do you have installed?
sitemap

Please provide any additional information below.

I debugged this issue and the solution is very simple, but I'm not familiar
with regexp. Inside the file "prettyUrls-Filters.php there is the following
code:

$context['pretty']['search_patterns'][] =
'~(<a[^>]+href=|<link[^>]+href=|<form[^>]+?action=)(\"[^\"#]+|\'[^\'#]+)~';

If applies a filter for any html related tag (<a><form><link>), cutting out
the following link used by sitemap:

<loc>http://site.com</loc>

It doesn't allow sitemap links to be "SEO".

Thanks!
emiliano

Original issue reported on code.google.com by emiliano.pecis on 14 Mar 2009 at 11:58

GoogleCodeExporter commented 8 years ago
At least one sitemap mod already supports this. The others need to add their own
search and replace patterns, so ask your mod's author to do that. It's very 
easy!

Original comment by curiousdannii on 15 Mar 2009 at 12:50

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
As I said, no I won't be adding this. This mod will account for all of SMF's 
normal
URLs, anything URL structure a mod adds should be added by that mod. The proper 
way
to do that is to add new search and replace patterns.

Original comment by curiousdannii on 16 Mar 2009 at 6:47

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
You just have $context['pretty']['search_patterns'][] = 'newpattern'; in your 
code.
Same for the replace pattern. You can see in the changes I make to News.php how 
I do
this for the feeds.

Original comment by curiousdannii on 16 Mar 2009 at 10:51

GoogleCodeExporter commented 8 years ago
Btw, I messaged the sitemap mod's author so hopefully will sort it out with him 
soon.

Original comment by curiousdannii on 16 Mar 2009 at 10:52