1

I created two Pages for header and footer, and I want to include them in the homepage template. I added the Page names in the Include Page URLs as testincludes (header) and footerincludes (footer) as in below image

enter image description here

We are not getting any header or footer in the page. How to add header and footer includes into the page?

4
  • The only difference I see with my DXA setup is that I don't have a leading / in my URLs, making it a relative rather than absolute path. Can you try that? Also, are these include pages published? If you load yoursite/testincludes, does the page load?
    – Nuno Linhares
    Commented Jun 6, 2017 at 13:27
  • We published and we are able to load the pages separately.We also tried removing the / in URL but no luck.
    – Lakshmi
    Commented Jun 6, 2017 at 13:38
  • I've added an answer which is based on some guesswork and assumtions. In case you can't make it work with this answer, please edit your question and provide some more information (see the questions in my answer). Commented Jun 6, 2017 at 13:52
  • Which version of DXA are you using? The screenshot shows that your include Pages are not in Home/_System/include (where they are expected to be; see Bart's answer) Have you tried changing their location? Commented Jun 7, 2017 at 16:46

1 Answer 1

5

If you look at the example website, then you can see that in, for example, the Home Page Page Template, it is using the following Include Page URLs:

  • system/include/header
  • system/include/footer

If you follow the documentation (chapter Managing page includes http://docs.sdl.com/LiveContent/content/en-US/SDL%20DXA-v7/GUID-5E88B1FC-FA9A-46F0-B7A5-89FCF058DB23), it mentions;

Includes are managed as Pages so that you can add and remove items (Component Presentations) and reference them using the include page URL.The page include contents are Component Presentations which you can edit and manage in Experience Manager. In Content Explorer, Include pages are located in the Home/_System/include Folder.

So if you then look in the Home/_System/include Folder, you will indeed see the pages which were used in the Home Page Page Template:

  • Header (header.html)
  • Footer (footer.html)

In an SDL Web 8 environment, you can simply right-click on them and select View on Site, and then you will see that it simply loads the Include Page with the following URL: /system/include/header.html (or /system/include/footer.html)

Combining that information tells us that the Include Page URL used in a Page Template, is actually the absolute URL of the (include) Page, without a trailing slash (/).

So let's start with a few questions:

  1. Where did you create your Include Page?
  2. Did you use the Include Page Page Template for it?
  3. Did you Publish it?
  4. Did you publish the Publish Settings Page?
  5. Did you refresh your application cache (by calling the admin/refresh URL)?

If you answered questions 2 to 5 with yes, then you can simply use the absolute URL of the Include Page, and remove the trailing slash (/). In your screenshot you seems to have the testincludes & footerincludes pages in the root of the website, if that is true, start with removing the trailing slash (/) from the URL, and follow up with executing the questions 4 & 5.

That should at least make sure the basic requirements are met. Now on to actually making it work;

By adding the Include Page URL in your Page Template, you bascially added a Region to that Page, so now you have to make sure the Region is displayed in the Page View. In other words, to use an Include Page, you have to add a Region to your Page View, and the Region Name will be the Title of your Include Page. So in your case, make sure that the Page Views where you are using these includes in them have something like:

@Html.DxaRegion("TestIncludes")

Note: This is assuming the Title of the /testincludes Page is TestIncludes

2
  • Used "Include Page" Page Template for it and published the publish settings page and cleared the application cache. When tried to debug the code(page controller ->ActionResult),not able to find the includes in the page model.
    – Lakshmi
    Commented Jun 7, 2017 at 14:36
  • @Lakshmi as mentioned, the includes are exposed as Regions Commented Jun 7, 2017 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.