We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13218
    • 134 Posts
    I set my Articles Container as site_start, so i can call it like
    mysite.com/

    instead of
    mysite.com/blog

    which works fine.

    But now, when i click on a tag on the site, the uri is
    mysite.com/tags/sometag

    and the ArticlesRouter doesn't find the Articles Container anymore, which has an alias 'blog' - that alias is not inserted in the tags-uri, since the blog is site_start.

    Is there an app for that?
      @itWilllBeOK
      • 13218
      • 134 Posts
      Ok, temporary work around:
      i specified a Tag Listing Chunk, where i hard-coded the blogs alias.
      <li><a href="/blog[[+url]]">[[+tag]]</a> ([[+count]])</li>

      Not pretty, but then i'm already pretty enough.
        @itWilllBeOK
        • 13460
        • 47 Posts
        It sounds to me like you have just to set your article resource-id as main under settings.
          UI /UX designer + bit of Front-End Developer. Getting around with MODx Revolution
          • 13218
          • 134 Posts
          Thanks for your answer.

          I'm not sure which setting you are referring to - if by "main" you mean setting the articles resource as the websites starting page i.e. 'site_start', this is exactly what causes the problem and is the reason for this post. As i said in the first sentence:
          I set my Articles Container as site_start, ...
          Or maybe you mean something different?
            @itWilllBeOK
            • 44960
            • 1 Posts
            I just ran into the same issue and fixed it another way which I thought I'd add to this thread.

            Just to confirm, ordinarily (when site_start is not equal to blog id), when you are either on the blog or on one of the articles:

            www.mysite.com/blog/
            www.mysite.com/blog/some-article-i-wrote/
            
            

            and you click on a tag, you'll be taken to a page listing all articles with that tag:

            www.mysite.com/blog/tags/some-tag
            


            BUT, when you set site_start to your blog id, then your blog and article url's become:

            www.mysite.com/
            www.mysite.com/blog/some-article-i-wrote/
            

            and when you click on a tag on either the full blog list or the article page itself, you are taken to this broken url:

            www.mysite.com/tags/some-tag
            

            Note the missing "/blog/".


            SOLUTION
            -----------

            On the main blog page, each blog entry is created using the samples.ArticleRowTpl chunk. In there you'll find that the list of tags is created as follows:

            [[+tv.articlestags:notempty=` | <span class="tags">[[%articles.tags]]: [[!tolinks? &items=`[[+tv.articlestags]]` &target=`[[*id]]` &useTagsFurl=`1`]]</span>`]]
            

            The toLinks snippet can accept a property called "tagKey" which is set to "tags" by default.

            So to fix this problem on the blog list, just add &tagKey=`blog/tags` to the toLinks call. I.e. change the above code to:

            [[+tv.articlestags:notempty=` | <span class="tags">[[%articles.tags]]: [[!tolinks? &items=`[[+tv.articlestags]]` &target=`[[*id]]` &useTagsFurl=`1` &tagKey=`blog/tags`]]</span>`]]
            

            The problem will still exist on the article page. The article page is created using the template: sample.ArticleTemplate. In there you'll find the lines:

            [[*articlestags:notempty=`
                    <span class="tags left"> | Tags: [[+article_tags]]</span>
            `]]
            

            Replace that code with: (note that &tagKey=`../tags` is used in this case).

            [[*articlestags:notempty=`<span class="tags">Tags: [[!tolinks? &items=`[[*articlestags]]` &target=`[[*id]]` &useTagsFurl=`1` &tagKey=`../tags`]]</span>`]]
            


            FIXED. The tag links will now be given the correct href on both the blog page and the article pages.

            WARNING: Instead of modifying samples.ArticleRowTpl and sample.ArticleTemplate, you should duplicate them, and modify the copies. Then in the blog settings, change the "Article Row Chunk" and "Article Template" to point to your copies. If you don't, your changes may be overridden next time you update the Articles add-on.


              • 3749
              • 24,544 Posts
              Interesting. Your post made me check the tag links on my blog for the first time and you're right -- none of them work. Unfortunately, my blog home page URL is in the form:

              mysite.com/blog.html

              I wish I'd ditched the .html suffix long ago, but it's too late now.

              The obvious choices for displaying tags don't work:


              mysite.com/blog.html/tags/tagname would be the obvious choice, but it just takes me to the blog's home page.

              mysite.com/blog/tags/tagname takes me to the site's home page.

              Strangely, the thing that works is

              mysite.com/blog.htmltags/tagname

              So my question is, should I try to make the tag links generate that URL, or is there some way I can make one of the URLs above work without trashing the rest of the site or existing links to my articles?

              BTW, my Archive links work as:

              mysite.com/blog.html2013/08
                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
              • As documentation on this topic is not too verbose ;-), I‘d share what worked for me.

                If blog home is the homepage of your site (site_start), and friendly_urls is on, your tags and archive links will need some extra settings.

                • container_suffix is /
                • add the container of your blog to all tags and archive links in your Articles templates.

                $articles-rowTpl, [[!tolink]]:
                - add &tagKey=`blog/tags`

                Articles Template, .post-info, [[!tolink]]:
                - add &tagKey=`blog/tags`, set &target=`[[*parent]]`

                Articles Template, #footer-content:
                - The +tags and +archives placeholders, i.e. what goes into them, should be edited, but I couldn’t find a way to do it (can anyone help?). So I edited the template files, causing me extra work for future updates to the Archives addon :-(.

                core/components/taglister/elements/chunks/tag.chunk.tpl
                - set <a href="/blog[[+url]]">

                core/components/archivist/elements/chunks/row.chunk.tpl
                - set <a href="/blog[[+url]]">

                If you had it different in the first place, you may want to do some retrofitting.
                - The new url scheme will apply to new blog posts only. Old blog posts keep their url, as it is stored in the database. There is no need to do anything about it, unless you prefer a consistent url scheme.
                - If they are not too many, you may want to edit your old blog post urls in the database, and redirect them in the .htaccess.
                - My container_suffix used to be .html, as I have first level documents in my site. Uncheck the container setting in your first level documents, should they be checked - now the url of your first level documents changes back to *.html.

                Hope this helps. [ed. note: BrigitteB last edited this post 9 years, 4 months ago.]
                  Brigitte Bornemann - Accessibility Consultant, Web Designer - Hamburg / Munich, Germany.
                  http://www.bit-informationsdesign.de
                  • 3749
                  • 24,544 Posts
                  Thanks for the report. The tag links on my blog work now, so I must have solved this, but I can't remember how. wink
                    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