Copied to clipboard

Flag this post as spam?

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


  • mikkel 143 posts 365 karma points
    Sep 18, 2017 @ 12:15
    mikkel
    0

    I always land on an empty page when I want to view my post , what to do

    Hi, I am making a page where all blog posts are displayed. When you click on the post, you must be sent to the page with the post. The first one works fine but when I click on the link that will send me to the post, I will be sent to an empty page. How do i do it??

    My partial view that runs through all posts.

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    
    @{
        var selection = Model.Content.Site().FirstChild("blog").Children("blogIndlaeg")
                            .Where(x => x.IsVisible());
    }
    <div class="container">
        <div class="row">
                <!-- Blog titel -->
                @Umbraco.Field("blogTitel")
                <br />
                @foreach(var item in selection){
    
                <!-- blog teaser -->
                @Umbraco.Field("blogTeaser")
                <br />
                <!-- Henter alle blog billederne -->
                <a href="@item.Url">
                    @{
                        var blogImage = item.GetPropertyValue<IPublishedContent>("fremhaevetBillede");
                        if (blogImage != null)
                        {
                            <img src="@blogImage.Url" class="img-responsive"style="width: 25%;"/>
                        }
                    }
                    </a>
                <br />
                <h4>@item.Name</h4>
                <br/>
                <a href="@item.Url">Læs mere</a>
                <hr>
    
        }
    
        </div>
    </div>
    

    The page where the specific post is displayed.

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.BlogIndlaeg>
    @using ContentModels = Umbraco.Web.PublishedContentModels;
    @{
        Layout = "Master.cshtml";
    }
    <div class="container">
        <div class="row">
       <!-- The blot title -->
    @Umbraco.Field("blogTitel")
    <br />
    <!-- The blog text -->
    @Umbraco.Field("bodyTekst")
        </div>
    </div>
    
  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Sep 18, 2017 @ 13:08
    Alex Skrypnyk
    0

    Hi Mikkel

    Empty page - did you mean just blank page?

    Do you have right Layout settings?

    Thanks,

    Alex

  • mikkel 143 posts 365 karma points
    Sep 20, 2017 @ 09:03
    mikkel
    0

    yep i getting a blank page, but should there not be som code to get the data with on that page ?

  • Craig Mayers 164 posts 508 karma points
    Sep 19, 2017 @ 08:47
    Craig Mayers
    0

    Hi Mikkel,

    Is the template selected on the node (see the Properties tab)?

    Have seen behaviour like this when people forget to select/change the template for a particular DocType.

    Craig

  • mikkel 143 posts 365 karma points
    Sep 19, 2017 @ 15:01
    mikkel
    0

    Hi Craig the template is selected but there should there not be some code to retrieve the specified post on the page??

Please Sign in or register to post replies

Write your reply to:

Draft