Skip to main content
Community site session details

Community site session details

Session Id :
Power Pages - Power Apps Portals
Unanswered

Web Template Extend | Using Variable

(0) ShareShare
ReportReport
Posted on by 37

Hi,

I have a variable defined in my header web template called contentPageTemplate 

 

{% assign contentPageTemplate = "Help-Content" %}

 

I have the following content template applied to my page and am wanting to use the variable defined in my header for use in the extends definition; but cannot get this to work.

 

{% extends contentPageTemplate %}
{% block main %}
 This is my page
{% endblock %}

 

Any ideas how this could be achieved?

Thanks,

  • oliver.rodrigues Profile Picture
    9,342 Most Valuable Professional on at
    Re: Web Template Extend | Using Variable

    "I have a web template called 'Configuration' which contains all the 'global' variables I need throughout my portal which is referenced from the header"

     

    maybe you should be using Site Settings instead? Available Liquid objects - Power Apps | Microsoft Docs

  • g.whammond Profile Picture
    37 on at
    Re: Web Template Extend | Using Variable

    @OliverRodriguesThank you for your response.

    Let's say I have 1000 web templates extending 'Header'.

     

    {% extends "Header" %}

     

    I want to update all 1000 web templates to now extend my newly created 'Oliver-Header' instead.

     

    {% extends "Oliver-Header" %}

     

    The problem I am having is i am manually having to go through each of the 1000 templates to update this one line

    I had hoped to be able to use a variable which had been defined in the header or somewhere similar.

     

    {% extends MyVariable %}

     

     

    @chleverenzI have a web template called 'Configuration' which contains all the 'global' variables I need throughout my portal which is referenced from the header. If this is what you are suggesting I already have this which means we are on the same page.

     

     


  • Christian Leverenz Profile Picture
    1,214 on at
    Re: Web Template Extend | Using Variable

    Hi @Gwham ,

    go for @OliverRodrigues advice. This will definitely work.

     

    Just to add one remark: you mentioned, that you define the variable in the header. Usually, you do not extend the header so the definititionplace is not the best one there. 

    May be using

    {% include 'valiabledecalrationtemplate' %}

    where the valiabledecalrationtemplate just contains your variabledefinitions as well in the header and in the template where the variable is needed is a better fit.

     

    Hope it inspires you for a solution,

      Christian

  • oliver.rodrigues Profile Picture
    9,342 Most Valuable Professional on at
    Re: Web Template Extend | Using Variable

    It might be the way you are using the extend Liquid tag, so basically:

    • The extend tag allows you to re-use an existing template, and overwrite content from the block you are specifying
    • You can reuse variables created on previous templates 

    For example, I am creating a simple liquid variable in the Header Web Template, and putting the content inside a block main:

    OliverRodrigues_1-1645723040363.png

     

    • Now I am creating a test web page/ web template and extending the Header, overwriting the main block:

    OliverRodrigues_2-1645723249752.png

     

    • this is my final result:

     

    OliverRodrigues_0-1645722966548.png

     

    so basically you don't extend a variable, you extend the entire Web Template, and the block is replaced with whatever you are extending

    give us more details of your scenario, perhaps there is another way of achieving what you need 

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Pages

#1
Lucas001 Profile Picture

Lucas001 60 Super User 2025 Season 1

#2
Fubar Profile Picture

Fubar 55 Super User 2025 Season 1

#3
surya narayanan Profile Picture

surya narayanan 35