Struggling with the tags concept

Hi all. Hopefully this is a simple conceptual misunderstanding. I want to create a group of posts. To do this I have created a tag (I will call my tag “intro” here). If I go to the “tags / edit tags” part of the admin console I can add the basic settings I want (header, short description and picture). This creates a link {my_website_name}/tag/intro/. What I can’t seem to do here however is ensure the posts are in ascending order according to publishing date.

If, however, I create a collection by editing the routes.yaml and add a collection like this:
collections:
/intro/:
permalink: /intro/{slug}/
template: index
filter: tag:intro
order: published_at asc

Then I can create a collection at {my_website_name}/intro/ (note that this address does not have the “tag” word in it) which I can group and post with, but then I do not have access to the content from the “basic settings” for the collection.

I really want to have my cake and eat it. I want to have a collection where I can set some basic collection content AND I want my posts to appear in ascending order. I am not stressed about the address for this as I can make either of the above (or anything else) work at this stage.

One way to do this is for me just to “hack” the publication dates but that seems extremely inelegant and I cannot imagine the creators of this software would not have a better approach. I am however “googled out” and have nothing constructive.

Any thoughts, advice or links to the relevant documentation would be great. I really have tried before I posted this question here.

Can you edit the theme? If you want all the tag pages in published order this should be an easy edit to tag.hbs, or you could create a custom version of index.hbs that pulls the data from the tag context.

Check out this Building content collections in Ghost

You need to:

  1. Create a tag intro as usual to have data like Image, meta data, etc.
  2. Then add data:tag.intro to overwrite the tag intro url from {my_website_name}/tag/intro/ to {my_website_name}/intro/
  3. Customize a litte index.hbs like change into {{ meta_title }} and {{ meta_description }} to have “basic setting” as you like at step#1

Final route as below

routes:

/intro/:
  permalink: /intro/{slug}/
  template: index
  data: tag.intro
  filter: tag:[intro]
  order: published_at asc

collections:
  /:
    permalink: /{slug}/
    template: index

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

Regarding to posts order for collection, you can use order: title asc instead of order: published_at asc to easily rule the order alphabetically. Then create a series of post and set title like Step 1, Step 2, Step 3, etc.

Then hidde all intro post as home page:

routes:

/intro/:
  permalink: /intro/{slug}/
  template: index
  data: tag.intro
  filter: tag:[intro]
  order: published_at asc

collections:
  /:
    permalink: /{slug}/
    template: index
    filter: tag:-[intro]

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

By the way, you can even create a course.

Thanks Cathy.

While I can edit the theme - in the sense that I have a local copy running, can make changes to .hbs files in vscode and can see the changes in the localhost version of my site and would be able to zip these up to ghost.org - I don’t have any background working with handlebars or web development so I’m like the proverbial blind squirrel hoping to stumble over a nut when I edit a .hbs files. For example, I tried including a #get statement before the #foreach loop in tags.hbs, with an ‘order’ parameter but it returns the full list of posts, not just the ones with the relevant tag. I am still fiddling with the ‘filter’ parameter but as I say, given how limited my understanding of this framework is, it just sort of “change and hope” at this stage which makes me nervous because my changes may have unintended consequences.

I was hoping there would be something that didn’t require “developer” understanding of the framework but I will continue fight with #get a little longer. I have looked at the documentation but it is not obvious for the novice user.

Ok, in the end I had to edit tag.hbs to get the desired result. I hope this does not cause any unforeseen issues. I had to add a {{#tag}} {{/tag}} section around the {{#get} {{/get}} command to get access to the filtered list of posts. The full tag.hbs file looks as follows:

{{!< default}}

<main class="gh-main gh-outer">
    {{#tag}}
        <section class="gh-article gh-inner">
            <header class="gh-article-header">
                <h1 class="gh-article-title">{{name}}</h1>
                {{#if description}}
                    <p class="gh-article-excerpt">{{description}}</p>
                {{/if}}
                {{> "feature-image"}}
            </header>
        </section>
    {{/tag}}
    <div class="gh-feed{{#match @custom.header_section_layout "!=" "Large background"}} gh-inner{{/match}}">
        {{#tag}}
            {{#get "posts" filter="primary_tag:{{slug}}" order="published_at asc" }}
                {{#foreach posts}}
                    {{> "loop"}}
                {{/foreach}}
            {{/get}}    
        {{/tag}}
    </div>
</main>