MODX Community

Static template does not process MODX tags (they show as text)

I’d like to move our templates over to static files, but when I did this, none of the MODX tags were processed. Any HTML shows up fine (headings, paragraphs, etc.), but if I refer to MODX page elements – such as [[*longtitle]] or [[*content]] – or MODX chunks or snippets – such as [[$myChunk]] and [[mySnippet]] – the MODX tags are displayed on the page as plain text and not processed. Any insights as to how to fix that?

I’m using MODX 2.7.1

This is an example of the literal text in the static file:

<html>
    <head>
        <title>[[*pagetitle]]</title>
    </head>
    <body>
        <h1>[[*longtitle]]</h1>
        [[*content]]
    </body>
</html>

The output on the web page in the source code is literally this, with the unprocessed MODX tags:

<html>
    <head>
        <title>[[*pagetitle]]</title>
    </head>
    <body>
        <h1>[[*longtitle]]</h1>
        [[*content]]
    </body>
</html>1

Also note the extra “1” at the very end of it all. That “1” shows up on the page and in the source code, but is not in the original file. I assume that’s a symptom of something not being processed as intended (PHP will sometimes output a “1” when a condition is true, for example).

Welcome to the community! :slight_smile:

Do you get any errors in the logs regarding your problem?

How is the the chunk content getting on the page (e.g., a chunk tag, snippet, getResources, etc.)?

How did you load your static file?