Copied to clipboard

Flag this post as spam?

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


  • Bobi 235 posts 637 karma points
    Mar 30, 2017 @ 23:31
    Bobi
    0

    how does the /categories/ page work?

    Hi,

    How does the categories page work, and in what view / partial view is the code located?

    I can't seem to totally find it. I see that some of it is in the Tags.cshtml view, but not all of it.

  • Marc Goodson 995 posts 6568 karma points MVP 4x c-trib
    Mar 31, 2017 @ 08:14
    Marc Goodson
    0

    Hi Bobi

    To allow certain aspects of articulate to be customisable (eg url names) Articulate uses a sophisticated routing technique, which involves created a VirtualNodeRouteHandler. You can see in the source of Articulate where this is setup:

    https://github.com/Shazwazza/Articulate/blob/master/src/Articulate/ArticulateTagsRouteHandler.cs

    and here you can see the rules for finding content for a request based on the provided custom urls configured for articulate for tags, categories etc.

    The following ArticulateTagsController is then triggered for a request to a categories page:

    https://github.com/Shazwazza/Articulate/blob/master/src/Articulate/Controllers/ArticulateTagsController.cs

    and RenderByTagOrCategory method pulls back content by tag or category and populates a ListModel, containing posts and the category you are searching by, returning the following:

    return View(PathHelper.GetThemeViewPath(listModel, "List"), listModel);

    The GetThemeViewPath will look for the current Articulate Theme folder eg

    /app_plugins/articulate/themes/[YourThemeName]

    and within the Views folder of your theme it is returning the List.cshtml view.

    If that helps understand what on earth is going on :-)

    regards

    Marc

  • Bobi 235 posts 637 karma points
    Mar 31, 2017 @ 19:26
    Bobi
    0

    Thanks Marc, that definitely helps. I am trying to display all of the blog posts on the primary blog page, so when a user navigates to the blog they are presented with all of the blog posts.

    I partially did this with the recent.cshtml view. However, I have run into issues with adding a pager to the recent.cshtml - it does not work correctly when calling the pager partial view in the list.cshtml view. I would just keep the recent.cshtml view is the main landing page, but when the number of blog posts substantially increases, I am worried that without the pager, things will be slow to load, and you cannot call all blog posts in the recent partial view...only a specified number.

    So I have been trying to determine a way to do the above with the tags.cshtml view, since I cannot add a pager to the recent partial view, nor use the recent partial to display all blog posts.

    Any ideas?

  • Marc Goodson 995 posts 6568 karma points MVP 4x c-trib
    Apr 01, 2017 @ 08:22
    Marc Goodson
    1

    Hi Bobi

    I think I understand what you mean.

    I created a blog a while back in an early version of articulate:

    http://dickiefelton.com/

    and if you scroll down and see, additional posts on the homepage can be loaded asynchronously by clicking the 'Load More Posts' option.

    This way people can still keep browsing blog articles if they wish, but the first load of the blog is kept small and loads reasonably quickly.

    regards

    Marc

  • Arlan Galvez 44 posts 175 karma points
    Jun 10, 2019 @ 19:06
    Arlan Galvez
    0

    Hello, how did you do the Load more action in your blog? Can you explain me please how to achieve this? Thank you!

  • Bobi 235 posts 637 karma points
    Apr 01, 2017 @ 18:07
    Bobi
    0

    Hi @marc, exactly! I am looking for either that, or paging, but I do like that load more option if it is simpler than dealing with the pager :s and recent.cshtml view.

    How did you do this? My recent looks like:

    @using Articulate
    @using Articulate.Models
    @inherits UmbracoViewPage<Articulate.Models.IMasterModel>
    
    @{
        var recent = Umbraco.GetRecentPosts(Model, 10);
    }
    
    @if (Model.Parent.Name != "Pages") { 
    
        <!-- Left Sidebar -->
        <div class="col-md-9 md-margin-bottom-40">
    
            @foreach (var post in recent)
                {
                <!--Blog Post-->
            <div class="row blog blog-medium margin-bottom-40">
    
                    <div class="col-md-5">
                        @if (!post.PostImageUrl.IsNullOrWhiteSpace())
                        {
                            var thumbnail = post.GetCropUrl("postImage", "miniBlogPost");
                            if (!thumbnail.IsNullOrWhiteSpace())
                            {
                                <a href="@post.Url"><img class="img-responsive" src="@thumbnail" title="@post.Name" alt="@post.Name Image" /></a>
                            }
                        }
                    </div>
                    <div class="col-md-7">
                        <h2><a href="@post.Url">@post.Name</a></h2>
                        <ul class="list-unstyled list-inline blog-info">
                            <li>
                                <i class="fa fa-calendar"></i> <time datetime="@post.PublishedDate">
                                    @post.PublishedDate.ToString("MMM d, yyyy")
                                </time>
                            </li>
                            <li><i class="fa fa-tags"></i> @Html.ListTags(post, @<a href="@Url.ArticulateTagUrl(Model, @item)">@item</a>)</li>
                        </ul>
                        <p>@post.Excerpt</p>
                        <p><a class="btn-u btn-u-sm" href="@post.Url">Read More <i class="fa fa-angle-double-right margin-left-5"></i></a></p>
                    </div>
    
            </div>
    
            <!--End Blog Post-->
            <hr class="margin-bottom-40">
            }
        </div>
        <!-- End Left Sidebar -->
    
        }
    
Please Sign in or register to post replies

Write your reply to:

Draft