Copied to clipboard

Flag this post as spam?

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


  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Mar 11, 2017 @ 12:31
    Michaël Vanbrabandt
    0

    Add parent nodename to the template in SEO Checker

    Hi Richard,

    is there a way to at the parent nodename into the template for a document type?

    Something like:

    [#@nodename] | [#@parent.nodeName] | Company 2017
    

    Have a nice day!

    /Michaël

  • Richard Soeteman 4035 posts 12842 karma points MVP
    Mar 14, 2017 @ 09:10
    Richard Soeteman
    0

    You can use [$parent-property-that-does-not-exists-on-currentdocument] then it will do a recursive lookup.

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Mar 15, 2017 @ 07:55
    Michaël Vanbrabandt
    0

    Richard,

    and what if it exists on the current and parent node, eg the nodeName of the node?

    Would be nice to automatically add the current node his parent node name to the template.

    /Michaël

  • Richard Soeteman 4035 posts 12842 karma points MVP
    Mar 15, 2017 @ 08:07
    Richard Soeteman
    0

    Not sure if that will work with [$..] parameter.

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Mar 15, 2017 @ 08:20
    Michaël Vanbrabandt
    0

    Richard,

    like I said on twitter will make some sort of mirror unique property on the parent node which contains the same value as its name which we then can call recursive on the child node template.

    Will let you know it this is working as expected!

    /Michaël

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Mar 15, 2017 @ 11:41
    Michaël Vanbrabandt
    100

    For anyone else that wants to achieve this, below is the solution:

    Create a new property editor ( in my case Property Mirror ) which contains the following html:

    <div ng-controller="Mivaweb.PropertyMirrorController">
        <input type="text" class="umb-editor umb-textstring" ng-model="model.value" disabled="disabled" />
    </div>
    

    then my controller looks like:

    angular.module("umbraco")
        .controller("Mivaweb.PropertyMirrorController",
    
        function ($scope, editorState) {
    
            $scope.editorState = editorState;
    
            $scope.model.value = $scope.editorState.current.name;
    
            $scope.$watch('editorState.current.name', function (newVal) {
                $scope.model.value = newVal;
            });
    
        }
    );
    

    As you can see, the only thing I do is watching the name of the node and set a mirror property the same as the name.

    Then in my child node, on the SEO Checker template I use the alias of my parent unique property to get the value:

    [#@seoTitle] | [$nameMirror] | Dierenarts Oosterlinck
    

    @Richard: Maybe something to implement into the seo checker core?

    Hope this helps!

    /Michaël

Please Sign in or register to post replies

Write your reply to:

Draft