# Debugging pages on site

**URL:** <https://community.bloomreach.com/t/debugging-pages-on-site/531>\
**Category:** Experience Manager (PaaS/OnPrem)\
**Created:** [October 26, 2018, 7:35pm UTC](https://community.bloomreach.com/t/debugging-pages-on-site/531 "2018-10-26T19:35:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robbert\_Kauffman](https://avatars.discourse-cdn.com/v4/letter/r/e5b9ba/32.png) [@Robbert\_Kauffman](https://community.bloomreach.com/u/Robbert_Kauffman)\
**Post date:** [October 26, 2018, 7:35pm UTC](https://community.bloomreach.com/t/debugging-pages-on-site/531/1 "2018-10-26T19:35:07Z")

</div>

Hi,

I wanted to share an easy way to enable debugging for pages in the site. This trick will output a bunch of information from the HST model of the viewed page to the browser console. So that you can debug why a certain component, container or template isn’t loading correctly. See screenshot below.

 ![41](https://canada1.discourse-cdn.com/flex027/uploads/bloomreach1/original/1X/52b5d555843dc019cca1f6090f85b56e93a9c8be.png)

To use this, copy + paste the FTL code below to a new template file, e.g. debugging.ftl. Then either import it from base-layout.ftl or from include/imports.ftl (depending on if you use one or more base-layout templates): \<#include “debugging.ftl”/\>

```
<#assign hst=JspTaglibs["http://www.hippoecm.org/jsp/hst/core"] >
<@hst.defineObjects />

<#if hstRequest.serverName=="localhost">
<script>
  if (!window.hstHasLogged) {
  console.log(
  {
    "resolvedSiteMapItem": "${hstRequest.requestContext.resolvedSiteMapItem.hstSiteMapItem.id}",
    "componentConfigurationId": "${hstRequest.requestContext.resolvedSiteMapItem.hstSiteMapItem.componentConfigurationId}",
    <#if hstRequest.requestContext.resolvedSiteMapItem.hstSiteMapItem.relativeContentPath??>
    "relativeContentPath": "${hstRequest.requestContext.resolvedSiteMapItem.hstSiteMapItem.relativeContentPath}",
    </#if>
    "componentConfigurationName": "${hstRequest.requestContext.resolvedSiteMapItem.hstComponentConfiguration.name}",
    "mountContentPath": "${hstRequest.requestContext.resolvedMount.mount.contentPath}",
    <#if hstRequest.requestContext.contentBean??>
    "contentBeanPath": "${hstRequest.requestContext.contentBean.node.parent.identifier}",
    "contentBeanUuid": "${hstRequest.requestContext.contentBean.node.parent.path}",
    </#if>
    "renderPath": "${hstRequest.requestContext.resolvedSiteMapItem.hstComponentConfiguration.renderPath}",
    "pageModel":
    <#assign components=hstRequest.requestContext.resolvedSiteMapItem.hstComponentConfiguration.children>
    <#if components?has_content>
    [
      <@listComponents components/>
    ]
    </#if>
  });
  window.hstHasLogged = true;
}
</script>
</#if>

<#macro listComponents components>
  <#list components?keys as component>
    {
      "id"
    :
      "${component}",
        "name"
    : "${components[component].name}",
    <#if components[component].renderPath??>
        "hst:renderpath": "${components[component].renderPath}",
    </#if>
    <#if components[component].componentClassName??>
        "hst:componentclassname": "${components[component].componentClassName}",
    </#if>
    <#if components[component].componentType??>
        "type": "${components[component].componentType}",
    </#if>

    <#if components[component].canonicalStoredLocation??>
        "path": "${components[component].canonicalStoredLocation}",
    </#if>
    <#if components[component].canonicalIdentifier??>
        "uuid": "${components[component].canonicalIdentifier}",
    </#if>
    <#if components[component].parameters?has_content>
      <#assign parameters=components[component].parameters>
        "hst:parameternames":
      [
      <#list parameters?keys as parameter>
            "${parameter}"<#if !parameter?is_last>, </#if>
      </#list>
      ],
        "hst:parametervalues"
    : [
      <#list parameters?keys as parameter>
            "${parameters[parameter]}"<#if !parameter?is_last>, </#if>
      </#list>
    ],
    </#if>
    <#if components[component].children?has_content>
        "components":
      [<@listComponents components[component].children/>]
    </#if>
    }<#if !component?is_last>,</#if>
  </#list>
</#macro>
```

---

<div class="post-metadata">

**Author:** ![jasper.floor](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/jasper.floor/32/28_2.png) [@jasper.floor](https://community.bloomreach.com/u/jasper.floor)\
**Post date:** [October 30, 2018, 8:14am UTC](https://community.bloomreach.com/t/debugging-pages-on-site/531/2 "2018-10-30T08:14:42Z")

</div>

I wonder if you can hook into the diagnostics to achieve the same limits (eg, limit on ip).
