greengerong / Prerender_asp_mvc

Prerende client for asp.net mvc
http://prerender.io/
86 stars 39 forks source link

Can you give examples of how to use the black list? #15

Closed hades200082 closed 7 years ago

hades200082 commented 9 years ago

I need to exclude URL's that have certain query strings (i.e. Google's ?utm_...) as well as certain paths on my site.

I see there is a blacklist option but I can't find any documentation about it.

thoop commented 9 years ago

Can you try passing it into the prerender config like this?

<prerender blacklist="/user"></prerender>
hades200082 commented 9 years ago

I have this currently...

    <prerender blacklist="/blog*,/blogs*,/admin*,/door-designer*,*\?ctype*,*\?utm*,*\?gclid*,*\.aspx*"\>

Will this work?
thoop commented 9 years ago

That should work. You can see the delimiter is the comma: https://github.com/greengerong/Prerender_asp_mvc/blob/1e68eaf3252420bd6c138c10a9777672d3f2c3d6/Prerender.io/PrerenderConfigSection.cs#L74

Those are regexes so should they be "/blog.,/blogs...." ?

hades200082 commented 9 years ago

Ok.. so how would I specifically target a querystring?

e.g. /foo?bar=123 OR /about?bar=123 to target any URL with "bar=123" on the querystring.

thoop commented 9 years ago

Probably something like /foo?.*bar=123

Why are you trying to target the query string? If you are using the hosted Prerender.io, you should just ignore the query strings from our UI.

tysonnero commented 8 years ago

@hades200082 Looking at the source code, the querystring can't be part of the whitelist/blacklist because it's only looking at HttpRequest.Url: https://github.com/greengerong/Prerender_asp_mvc/blob/master/Prerender.io/PrerenderModule.cs#L150.

greengerong commented 8 years ago

@hades200082 Still want to got blacklist with querystring?

greengerong commented 8 years ago

@tysonnero There use regex.IsMatch(url.AbsoluteUri) . You can check the the document https://msdn.microsoft.com/zh-cn/library/system.uri.absoluteuri(v=VS.110).aspx.