Hi,
you should extend the macro to add the page query param, for example:
// Makes all methods in the 'CustomMacroMethods' container class available for string objects
[assembly: RegisterExtension(typeof(CanonicalLinks), typeof(string))]
// Registers methods from the 'CustomMacroMethods' container into the "String" macro namespace
[assembly: RegisterExtension(typeof(CanonicalLinks), typeof(StringNamespace))]
public class CanonicalLinks : MacroMethodContainer
{
[MacroMethod(typeof(string), "Adds canonical links for linked pages", 0)]
[MacroMethodParam(0, "param1", typeof(bool), "Add canonical links for all pages")]
public static object AddCanonicalLink(EvaluationContext context, params object[] parameters)
{
// Branches according to the number of the method's parameters
switch (parameters.Length)
{
case 1:
if (ValidationHelper.GetBoolean(parameters[0], false))
{
break;
}
if (DocumentContext.CurrentDocument.IsLink) {
break;
}
return "";
default:
if (DocumentContext.CurrentDocument.IsLink) {
break;
}
return "";
}
var href = new TreeProvider().SelectSingleNode(DocumentContext.CurrentDocument.OriginalNodeID, context.Culture).AbsoluteURL;
if (!string.IsNullOrEmpty(QueryHelper.GetString("page", "")))
{
href = URLHelper.AddParameterToUrl(href, "page", QueryHelper.GetString("page", ""));
}
return "<link rel=\"canonical\" href=\"" + href + "\" />";
}
}
To solve the problem with the next and prev links, I think you shoud write output filter.