Search Knowledgebase:![]() |
Merge Pages via Plugin
User question:
> I have a page with the format http://www.domain.com/match and want
> to merge with sub pages. The sub pages have the format
> http://www.domain.com/match/page/2
> http://www.domain.com/match/page/3
> and so on. How can I do that
> since the Merge feature only supports URLs with parameters.
If the sub pages don't have parameters (such as &page=NN) then you have to create a private plugin to merge these pages into a single page. The source code below will work with the URL syntax in the provided example:
Sub Wsw_MergePages(Handle, ..........)
Dim nParamPageNumber, sFilename
If nPageNumber > 5 Then
Return
End If
sFilename = GetFirstRegexMatch(sUrl, "page\/\d+")
If sFilename = "" Then
nParamPageNumber = 2
Else
sUrl = ReplaceText(sUrl, sFilename, "")
nParamPageNumber = CInt(ExtractDigits(sFilename)) + 1
End If
sFilename = "page/" + CStr(nParamPageNumber)
sUrl = sUrl + AddSlash(sFilename)
If Pos(sUrl, sMemWeb) > 0 Then
sStatusMessage = "New page via Merge-Plugin"
sNewUrl = sUrl
Else
sStatusMessage = "Merge-Plugin executed"
End If
End Sub