Copied to clipboard

Flag this post as spam?

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


  • Jesse Andrews 191 posts 716 karma points c-trib
    Jul 10, 2017 @ 23:18
    Jesse Andrews
    0

    Wrong meta data gathered when pulling from page other than the current one

    Umbraco Version: 7.6.3

    SEO Checker Version: 10.0.1

    I'm trying to create an rss feed using meta data stored by seo checker, but it isn't pulling the correct information. Here is the code I am using

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
        Layout = null;
        Response.ContentType = "text/xml";
        var metaData = Model.Content.GetPropertyValue<SEOChecker.MVC.MetaData>("seoSettings");
    }<?xml version="1.0" encoding="utf-8" ?>
    <rss version="2.0">
        <channel>
            <title>@metaData.Title</title>
            <description>@metaData.Description</description>
            @Html.Raw("<link>" + Model.Content.AncestorOrSelf(1).UrlAbsolute() + "</link>")
            @foreach (var child in Model.Content.Children.OrderByDescending(x => x.HasValue("publishedDate") ? x.GetPropertyValue<DateTime>("publishedDate") : x.CreateDate)) {
                var data = child.GetPropertyValue<SEOChecker.MVC.MetaData>("seoSettings");
                <item>
                    <title>@data.Title</title>
                    <description>@data.Description</description>
                    @Html.Raw("<link>" + child.UrlAbsolute() + "</link>")
                </item>
            }
        </channel>
    </rss>
    

    It works for the blog page and also works when I navigate to the individual blog posts, but when I access the blog posts inside a foreach loop, they just grab the data from the blog instead of the individual posts, as shown below. Rss feed output

    The only page with "test" for the description is the blog, which is also the only place that has a description entered manually. The blog posts are mapped to a separate "summary" property using seo checker's document type settings panel. Here is a screenshot of seo data for the first blog post, which doesn't match what is pulled by the foreach loop. First Blog Post data

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Jul 11, 2017 @ 06:41
    Richard Soeteman
    0

    Hi Jesse,

    This is by design. SEOChecker needs the context of the page to render all metadata. Maybe it will change for v2.

    Best,

    Richard

  • Jesse Andrews 191 posts 716 karma points c-trib
    Jul 12, 2017 @ 21:06
    Jesse Andrews
    0

    Yeah, this would be nice to have for v2. I had wanted to take advantage of seo checker's doc type property mappings for this, but I can work around this issue.

Please Sign in or register to post replies

Write your reply to:

Draft