Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

ReferenceError: "inheritedPageProperties" is not defined

Avatar

Level 2

I'm using the "inheritedPageProperties" global HTL object however, in AEM 6.3 my page is generating the following error when ?wcmmode=disabled is added to my page URL "ReferenceError: "inheritedPageProperties" is not defined"

If I load the page in regular authoring edit mode (without wcmmode=disabled) I don't see the error on the page.

I'm calling this object like so: page.layoutWidth = inheritedPageProperties.get(CONST.PROP_LAYOUT_WIDTH, "");

Any ideas?

Thanks in advanced!

7 Replies

Avatar

Level 2

Here's the code sample:

So I'm calling page.js like so:

<div class="site-wrapper" data-sly-use.main="main.js" data-sly-use.page="../page.js">
...
</div>

Page.js:

"use strict";

var global = this;
use(function () {

   var CONST = {

   HIDE_PRINT: "hidePrintBtn",
   HIDE_IN_NAV: "hideInNav",
   PROP_LAYOUT_WIDTH: "layoutWidth",
   };

   var page = {};

   // The actual content
   page.Lang = currentPage.getLanguage(true).getLanguage();
   page.hidePrint = pageProperties.get(CONST.HIDE_PRINT);
   page.hideInNav = pageProperties.get(CONST.HIDE_IN_NAV);
   page.layoutWidth = inheritedPageProperties.get(CONST.PROP_LAYOUT_WIDTH, "");

   }

  
  // Adding the constants to the exposed API
   page.CONST = CONST;

   return page;

});

Avatar

Employee

Can you try to pass in this object? Just to see if that works.

Avatar

Level 2

What do you mean? I tried adding the "inheritedPageProperties" in my sightly HTML like so : <h1> test ${inheritedPageProperties} </h1> and this prints out "test jcr:primaryType,jcr:createdBy,jcr:title,cq:template,jcr:created,cq:lastModified,sling:resourceType,cq:lastModifiedBy"

Avatar

Level 5

Hi Daniel

I am able to see any proper document of javascript Use api global object.I think inheritedPageProperties object is not in javascript use api that's why that not define error is comming.

You can use this

${inheritedPageProperties.layoutWidth} 

and check in sightly your result is comming.If your result is expected pass then pass this value to javascript like this

<div data-sly-use.params="${'params.js' @ value1='${inheritedPageProperties.layoutWidth} '}">

</div>

and catch this value in javascript like

var retValue = this.value1;

and use this value wherever you want.

Avatar

Level 2

Thanks for your reply.

So this documentation page states all the global objects: HTL Global Objects

As you can see, the "inheritedPageProperties" is part of the global HTL objects as well as "pageProperties" (which I'm using in my code above and is not generating errors).

This is not happening on AEM 6.2, only 6.3 CFP1

Avatar

Level 2

Confirmed by Daycare that this is a bug in 6.3