Copied to clipboard

Flag this post as spam?

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


  • Simon Dingley 1474 posts 3431 karma points c-trib
    Feb 20, 2019 @ 15:07
    Simon Dingley
    0

    Problems Accessing SEO Data in Search Results

    Hi Richard,

    I am trying to use the meta description in search results. I have my examine search results from which I get the content node and then try to access the seoChecker property as below.

    However, SEO Data is coming back empty and I'm not 100% sure why. Interestingly, if I attempt to inspect the data it is showing a canonical url for the search page and not the content node.

    @if (Model.Results.HasAny())
    {
        foreach (var result in Model.Results)
        {
            var contentNode = Umbraco.TypedContent(result.Id);
            var seoData = contentNode.GetPropertyValue<MetaData>("seoChecker");
            […]
        }
    }
    

    If I visit the actual page itself the meta tags are getting populated as expected.

    Any ideas?

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Feb 21, 2019 @ 07:05
    Richard Soeteman
    0

    Hi Simon,

    When you request a page SEOChecker checks all the info based on the context of the page therefore it's not in the Current Metadata. I have seen some improvements in this area and if you are up for testing this I can see if this can be improved the next coming days.

    Best,

    Richard

  • Simon Dingley 1474 posts 3431 karma points c-trib
    Feb 21, 2019 @ 07:15
    Simon Dingley
    0

    Hi Richard,

    Yes, I'm up for testing it as its a bit of a show stopper at the moment. Had I known earlier on I would have implemented custom fields to hold that data?

    Perhaps I can get the raw property value and serialise it to a MetaData object that allows me to get at what I need?

    Thanks, Simon

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Feb 21, 2019 @ 07:25
    Richard Soeteman
    100

    Check the manual, there is a native Metadata class as well where you can pass in the id. This will work perfectly for Metadata that is stored in the description fields.

    But I will follow up on this one later today/tomorrow

    Best,

    Richard

  • Simon Dingley 1474 posts 3431 karma points c-trib
    Feb 21, 2019 @ 07:37
    Simon Dingley
    0

    Check the manual, there is a native Metadata class as well where you can pass in the id

    Duh! Thanks Richard, that works perfectly.

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Feb 21, 2019 @ 07:42
    Richard Soeteman
    1

    Great to hear,

    Almost refactored the MVC library as well so it's no longer Context aware. Only thing left then is the PropertyEditorConverte that needs to pass in the document Id ;-)

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Feb 21, 2019 @ 09:39
    Richard Soeteman
    0

    Hi Simon,

    I've Added this to the MVC Metadata object that is responisble for making sure all Metadata for the page is available. It's not possible to use a PropertyEditorConverterfor this since I need the context of the whole page and a node id is missing when converting the value.

    Sample below works

    @{
        var meta = new SEOChecker.MVC.MetaData(your umbraco node id here);
    }
    @meta.Description //Gives you the Description or default SEODescription
    

    You can download the hotfix via dropbox and this will be part of 2.2.4(+)

    Hope this helps,

    Richard

  • Simon Dingley 1474 posts 3431 karma points c-trib
    Feb 22, 2019 @ 14:41
    Simon Dingley
    0

    Thanks Richard. Your example actually works with my current version of the package without needing an upgrade or hotfix.

    Great support for a great package as usual!

Please Sign in or register to post replies

Write your reply to:

Draft