You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+42Lines changed: 42 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,6 +82,48 @@ s = s.SetMultiThread(false)
82
82
s:= sitemap.New().SetMultiThread(false)
83
83
```
84
84
85
+
#### Follow rules
86
+
87
+
To set the follow rules, use the `SetFollow()` function. It should be specified a `[]string` value.
88
+
It is a list of regular expressions. When parsing a sitemap index, only sitemaps with a `loc` that matches one of these expressions will be followed and parsed.
89
+
If no follow rules are provided, all sitemaps in the index are followed.
90
+
91
+
```go
92
+
s:= sitemap.New()
93
+
s.SetFollow([]string{
94
+
`\.xml$`,
95
+
`\.xml\.gz$`,
96
+
})
97
+
```
98
+
... or ...
99
+
```go
100
+
s:= sitemap.New().SetFollow([]string{
101
+
`\.xml$`,
102
+
`\.xml\.gz$`,
103
+
})
104
+
```
105
+
106
+
#### URL rules
107
+
108
+
To set the URL rules, use the `SetRules()` function. It should be specified a `[]string` value.
109
+
It is a list of regular expressions. Only URLs that match one of these expressions will be included in the final result.
110
+
If no rules are provided, all URLs found are included.
111
+
112
+
```go
113
+
s:= sitemap.New()
114
+
s.SetRules([]string{
115
+
`product/`,
116
+
`category/`,
117
+
})
118
+
```
119
+
... or ...
120
+
```go
121
+
s:= sitemap.New().SetRules([]string{
122
+
`product/`,
123
+
`category/`,
124
+
})
125
+
```
126
+
85
127
#### Chaining methods
86
128
87
129
In both cases, the functions return a pointer to the main object of the package, allowing you to chain these setting methods in a fluent interface style:
0 commit comments