Copied to clipboard

Flag this post as spam?

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


  • hassanisback 8 posts 78 karma points
    Feb 06, 2018 @ 16:00
    hassanisback
    0

    How to use a template without input data in the content page

    Hi I am trying to adding a sub page in the content area but dont want to input the content in the Content/Section Content area but would like to use a template which will have all the html code. Is that possible and which way? Thanks in advance!

  • Marc Love (uSkinned.net) 447 posts 1789 karma points
    Feb 06, 2018 @ 16:52
    Marc Love (uSkinned.net)
    1

    Go to Settings > Templates in the Umbraco CMS and then create a new template.

    Paste all of your static HTML directly into the template.

    Go to Settings > Document Types

    Find the Document Type that controls your sub page.

    Choose Templates, top right of screen.

    Add your new template as an option.

    Go to Content and open your sub page.

    Go to the properties tab and select your new template from the 'Template' dropdown.

    Save and publish and your page will now use this template.

  • hassanisback 8 posts 78 karma points
    Feb 07, 2018 @ 12:07
    hassanisback
    0

    Hi Marc Thanks for the help. That is exactly what I did, but didn't work. That is I cant see my page section (template with the html) in my subpage. I wonder do I need to RENDER the section template somewhere in the subpage template, as like as we render partial view in template?

    Thanks a lot!

  • hassanisback 8 posts 78 karma points
    Feb 07, 2018 @ 12:14
    hassanisback
    0

    One more thing, to make it more clear, right now I am using @item.PageContent to get the sections in the subpage. But the thing is I want to move this part and want to have html separate in many sections, so that I can just put them in the subpage instead of putting things in the page content (in the content section). The current code which loops through the all sections and render the subpage sections looks this: var selection = Model.Content.Site() .FirstChild(x => x.Id == CurrentPage.Id) .Children

    @foreach(var item in selection){
    <section class="wrapper @item.SectionClass">
       @item.PageContent
    
    </section>  
    
    
    }
    

    what can be used to get the sections here in the loop instead @item.PageContent ? Thanks

Please Sign in or register to post replies

Write your reply to:

Draft