Template Rule in page delivery | Community
Skip to main content
Level 2
April 12, 2023
Solved

Template Rule in page delivery

  • April 12, 2023
  • 1 reply
  • 2023 views

Hi,

I want to implement a usecase where the requirement is to have the same experience on multiple pages.

Its actually a change in Header which we want to implement for a specific set of pages for a specific audience.

 

for example setting an activity on below url

/content/a/b/c.html

made some changes here on page "c', and Now I want to have similar experience on all the pages comes after "c" in content hierarchy .

example 

/content/a/b/c/d.html

/content/a/b/c/e.html

/content/a/b/c/f.html

etc..

 

I tried Page delivery option with additional template rules

as URL contains "c"

or path contains "c"  like this many things.

 

But that did not worked..

 

I tried Adding pages functionality as well it worked but then I have to add all pages again and again and make changes in each one of them.

..

if anyone has implemented this before please do let me know.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by alexbishop

Ok, so if you take the CSS selector that's being used in the modification in Visual Editor, visit one of the pages where the change doesn't work, and use

document.querySelector('your-css-selector')

Does that return an element? I.e., it doesn't return null


1 reply

alexbishop
Adobe Employee
Adobe Employee
April 12, 2023

A template rule of, for example, "URL contains /content/a/b/c/" should work fine.

There are two things that might be happening:
i) You're not qualifying for the activity
When you visit, for example, /content/a/b/c/d.html are you entered into the activity?
-You can check this in the response from Target. 

ii) You're qualifying for the activity but the Target modifications aren't being applied
The html might be different on each of the pages e.g. you've designed your experience in the Visual Editor and the modification is applied to a particular element with an ID of #button123 but that element ID is different on each of the additional pages you're targeting, so the modifications won't be applied.
-If this is the case then you need to update the CSS selector in your modification in Visual Editor 

varun790Author
Level 2
April 13, 2023

Hi,

Thanks for responding on this.

I did debug and found missing selector issue

template rule is working fine when I make changes on other content.

But our requirement is for header navigation and its not working for that case...

Structure is not getting changed as is the same header we are using for all the pages..

Header Structure remains the same. 

alexbishop
Adobe Employee
alexbishopAdobe EmployeeAccepted solution
Adobe Employee
April 13, 2023

Ok, so if you take the CSS selector that's being used in the modification in Visual Editor, visit one of the pages where the change doesn't work, and use

document.querySelector('your-css-selector')

Does that return an element? I.e., it doesn't return null