In N2CMS, can you disable the prompt to 'Update links leading to' the item you just edited?

StackOverflow https://stackoverflow.com/questions/14558122

  •  05-03-2022
  •  | 
  •  

Frage

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?

War es hilfreich?

Lösung

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)
        {
        }
    }
    

Andere Tipps

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].

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top