Expand my Community achievements bar.

Issue with teaser images with resource mapping

Avatar

Level 4

Hi All,

I am using resource mapping to shorten the website URL. It works fine for all the scenarios except that core images authored as part of teaser component are not showing up. When I tried to debug the issue, I found out that the issue is happening as image path is pointing to nodes under /content and because of resource mapping image path is also getting shortened and thus returning 404.

When I try to access image with full path then it loads up properly.

E.g.

I have teaser component authored on my home page of demo.com website. After adding the the resource mapping and trying to access domo.com, it server tries to load image from below url and thus throwing 404 error:

https://demo.com_jcr_content/root/responsivegrid/responsivegrid_1471831795/responsivegrid_165…

If i try to access full URL for image then image is loading fine

https://demo.com/content/demo/us/en/_jcr_content/root/responsivegrid/responsivegrid_1471831795/respo...

Is there a way that shortening of these image paths can be ignored and rule only applies for webpages? Or else is there any other solution that can used here?

Below is sample resource mapping that I am using for demo.com.

{

    "jcr:primaryType": "sling:Folder",

    "demo.com": {

        "jcr:primaryType": "sling:Mapping",

        "sling:internalRedirect": [

            "/content/demo/us/en"

        ],

        "demo_com_content": {

            "jcr:primaryType": "sling:Mapping",

            "sling:match": "(.+)$",

            "sling:internalRedirect": [

                "/content/demo/us/en/$1",

                "/$1"

            ]

        },

        "reverse_mapping_content": {

            "jcr:primaryType": "sling:Mapping",

            "sling:match": "$1",

            "sling:internalRedirect": [

                "/content/demo/us/en/(.*).html"

            ]

        },

        "reverse_mapping_content_nohtml": {

            "jcr:primaryType": "sling:Mapping",

            "sling:match": "$1",

            "sling:internalRedirect": [

                "/content/demo/us/en/(.*)"

            ]

        },

        "reverse_mapping_root": {

            "jcr:primaryType": "sling:Mapping",

            "sling:match": "$",

            "sling:internalRedirect": [

                "/content/demo/us/en(.html)?"

            ]

        }

    },

    "demo_com_root": {

        "jcr:primaryType": "sling:Mapping",

        "sling:match": "demo.com$",

        "sling:internalRedirect": [

            "/content/demo/us/en.html"

        ]

    }

}

10 Replies