Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rob Watkins 369 posts 701 karma points
    Aug 29, 2023 @ 12:01
    Rob Watkins
    0

    Umbraco 12 - simplest custom section

    I want a custom section that will simply be a static HTML page that provides a view on custom functionality.

    I have app functionality that is completely separate from Umbraco and accessed view a Javascript API; I want it available within Umbraco so users have a centralised interface, but I want to keep it completely untied to the CMS, because it is not CMS functionality and needs to be easy to separate out if required.

    I've gone through the custom section creation and have a new menu item and a blank page, but now all I need is just to display my own page in that space; I don't need trees, or any kind of hooks into Umbraco - just the ability to put markup there; al of the following documentation assumes you'll want to hook into the trees and write controllers etc.

    Is there any way of bypassing that and just saying "display this HTML file"?

    And if not, what's the simplest way of doing what I want?

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Aug 29, 2023 @ 13:14
    Marc Goodson
    0

    Hi Rob

    I think you can create what is known as a 'Single Node Tree'

    https://docs.umbraco.com/umbraco-cms/extending/section-trees/trees#single-node-trees-customising-the-root-node-action

    Here you still need a c# controller that inherits from TreeController, the trick is to override CreateRootNode method and set a 'RoutePath', and this will make a request to the specified routename.html file, from a path depending on whether you created a PluginController or not...

    Which can then house your custom javascript to request to the outside world.

    You can also make this HTML file stretch the full width of the backoffice (eg like the packages section) by setting IsSingleNodeTree = true on the Tree attribute that decorates your custom controller.

    https://docs.umbraco.com/umbraco-cms/extending/section-trees/trees#full-width-app-issinglenodetree

    regards Marc

Please Sign in or register to post replies

Write your reply to:

Draft