We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53081
    • 4 Posts
    I appear to be unable to change the default templates for Articles on MODx. Well, that's not entirely true, I can change them, but even minor changes to the html code breaks everything in them. I can't use a custom template at all because it refuses to grab my header or use my stylesheet. I'll show you what I mean:

    This is how my site is supposed to look, more or less


    This is what it looks like when I try to use that layout for the Articles template:


    And here's what happens when I click on the title of the blog post instead of taking me to the post it does this:


    Now, I've tried editing the default templates, only removing enough to add in the [[$head]] and [[$foot]] calls and the same thing happens. I've also tried just using the same template for all pages, nothing works. My custom design works just fine on normal pages, but for some reason Articles breaks everything about it. What am I doing wrong?

    For the record, here's how pretty much all of the templates are laid out:
    [[$head]]
    [[$menu]]
    [[*content]]
    [[$footer]]

    And I haven't made any changes to the content box on the Blog container page, that is still like this:
    [[+articles]]

    [[!+page.nav:notempty=`
    <div class='paging'>
    <ul class='pageList'>
    [[+paging]]
    </ul>
    </div>
    `]]

    Any help would be appreciated.

    This question has been answered by BobRay. See the first response.

      • 3749
      • 24,544 Posts
      That's odd. Many of us have made extensive changes to the ArticlesContainerTemplate and the ArticleTemplate.

      You are setting the templates to use on the "Templates" tab when editing the main blog container, right?

      The only other things I can think of are:

      1. Do a "view source" on the page and see where it's looking for the CSS and images.

      2. Check the HTML of the page at https://validator.w3.org/ to see if there's some fatal flaw in the HTML.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 53081
        • 4 Posts
        Thank you for responding. I am absolutely setting the templates in the "Templates" tab, I double checked lol. Viewing the source looks like everything should be showing up correctly, it's looking for the CSS at "assets/css/style.css" and the header image at "assets/images/header.png" like it should be. I did run a check and didn't come up with any major errors in the HTML. It's odd because I modified the same layout for WordPress (different file, I'm not trying to use the WordPress Theme here lol) and it worked perfectly, but for some reason I can't get it to work with this when that should be simpler by a country mile.
        • discuss.answer
          • 3749
          • 24,544 Posts
          Make sure you have this in the head section of the Template (with the exclamation point):

          <base href="[[!++site_url]]" />


          You could also try putting a full URL (http:// and all) for the css and images.

          Beyond that, I'm stumped.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 53081
            • 4 Posts
            That did the trick! Thanks man. I can't believe it was something so simple haha, that's how it usually goes for me....
              • 3749
              • 24,544 Posts
              I'm glad you got it sorted, but which thing did it?
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 53081
                • 4 Posts

                This is the thing I was missing. I can't believe it was so simple, and I really appreciate you pointing that out for me.
                <base href="[[!++site_url]]">

                  • 3749
                  • 24,544 Posts
                  It's often forgotten, but required in all MODX Templates. smiley
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting