statamic / ssg

The official Statamic Static Site Generator
229 stars 23 forks source link

Solved - Taxonomy index page gives 404 #147

Closed mbootsman closed 9 months ago

mbootsman commented 10 months ago

I have added one taxonomy: categories. This is enabled for two collections, blogs and notes.

Created index.antlers.html in /resources/views/categories This is the content:

<main class="prose fluid-container" id="content">
    <h1>{{ title }}</h1>
    <p>Here are all the categories I wrote about.</p>
    <ul class="list-none">
        {{ terms sort="title:asc"}}

            {{ blogs_count = 0 }}

            {{ collection:blog taxonomy:categories="{{ slug }}" as "blogs" }}
            {{ blogs_count = entries | count }}
            {{ /collection:blog}}

            {{ if blogs_count > 0 }}
                {{ if blogs_count > 1 }}
                    {{ link_title = "Category {{ title }} has {{ blogs_count }} articles" }}
                {{ else }}
                    {{ link_title = "Category {{ title }} has {{ blogs_count }} article" }}
                {{ /if }}
                <li class="inline-block work rounded-md">
                    <a class="no-underline" title="{{ link_title }}" href="{{ url }}">{{ title }}<sup class="mx-1 ">({{ blogs_count }})</sup></a>
                </li>
            {{ /if }}

        {{ /terms }}
    </ul>
</main>

When running Statamic, the page is visible. After generating with SSG, the categories terms pages are generated, but not the index.html in /categories.

mbootsman commented 9 months ago

Added the /categories' URL tossg.php`. And now it works.