Copied to clipboard

Flag this post as spam?

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


  • Lewis Smith 211 posts 620 karma points c-trib
    Jun 18, 2018 @ 08:27
    Lewis Smith
    0

    On page load

    Hi all,

    I'm looking to hit a method on page load for certain document types. This will allow me to check if the page (retail page) has products before the page has loaded. If not I can update the page status which should help to rank the page with Google.

    I know there is the ApplicationEventHandler which has ApplicationStarted, is there anything that I can override so it triggers on the start of page load so i can get in there to update the status before its too late?

    Thanks, Lewis

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Jun 18, 2018 @ 09:06
    Dave Woestenborghs
    0

    Hi Lewis,

    What status do you want to return ?

    Dave

  • Alex Brown 129 posts 620 karma points
    Jun 18, 2018 @ 09:13
    Alex Brown
    0

    I'd consider a RenderMvcController.

    The name of your controller must match your document typename, and the method name must match the template name. E.g. below, I have a document type called "Product" and a template attached to it called "Product".

    public class ProductController : RenderMvcController
    {
        public ActionResult Product(IPublishedContent content)
        {
    
        }
    }
    
  • Lewis Smith 211 posts 620 karma points c-trib
    Jun 18, 2018 @ 10:11
    Lewis Smith
    0

    Hi Alex,

    This is the solution im trying to avoid. We have multiple different document types for products and this would need this check on each one. I could create a link to a helper controller which could do the same but im trying to future proof the site so we can extend the if needed. A page load method would work better but if not this is the route I will go down.

    thanks, Lewis

Please Sign in or register to post replies

Write your reply to:

Draft