1

I am using N2CMS to manage the content of my site without using the page routing from N2. Hence when I edit a piece of content, it's quite useless when N2 asks me: "Update links leading to..." "Add permanent redirect at previous URL?". Can I disable this behaviour?

Tom Bull
  • 1,189
  • 13
  • 17

2 Answers2

2

Converting Page into Part is inherently bad idea. It may be temporary fix for the problem you have, but it will bounce back at you in a bad way.

Instead, you can do this

  • Turn LinkTracker off in web.config

    linkTracker enabled="false" permanentRedirectEnabled="false"
    
  • Copy CommandFactory.cs from N2 Source into your solution, and rename it to MyCommandFactory.cs. Add Service replacement attribute

    [Service(typeof(ICommandFactory), Replaces = typeof(CommandFactory))]
    

In a constructor, change this line

updateReferences = new MyUpdateReferencesCommand();
  • Write your own empty Update reference command class

    public class MyUpdateReferencesCommand : UpdateReferencesCommand
    {
        public override void Process(CommandContext state)
        {
        }
    }
    
Michael Celey
  • 12,645
  • 6
  • 57
  • 62
Dejan Milicic
  • 819
  • 9
  • 18
  • In my project, I am not using any of the N2 routing or templating. I have written my own wrapper classes to get the content from the N2 object model and place it in existing pages. It seems to make no difference whether I use [PageDefinition] or [PartDefinition] apart from the interface used to edit them (actually [PartDefinition] is more appropriate interface for the content in question). Can you tell me what problems I might face in the future going down this route? – Tom Bull Jan 30 '13 at 13:08
  • Well, that depends on extent of your replacements. If you replaced most of the functionalities of N2 with your own, then you will probably have no problems. – Dejan Milicic Jan 30 '13 at 13:23
0

As far as I can see from the source code, N2 expects always to show you the "Update links leading to..." page if the ContentItem is a Page (i.e. [PageDefinition] attribute or .IsPage = true) and the address has been updated. The solution in our case was to make the 'page' in question into a 'part' using [PartDefinition].

Tom Bull
  • 1,189
  • 13
  • 17