Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

categories list now work #755

Open
hoomanjavadpoor opened this issue Sep 6, 2023 · 3 comments
Open

categories list now work #755

hoomanjavadpoor opened this issue Sep 6, 2023 · 3 comments

Comments

@hoomanjavadpoor
Copy link

hoomanjavadpoor commented Sep 6, 2023

Hi everyone
I can't get the list of all categories in my template do you have any idea?

<!-- Categories Start -->
<div class="row block_categories block_sidebar">
    <div class="wighet-title">{% trans "Categories" %}</div>
    <div class="row block_sidebar_content">
    <div class="sidebar_categories">
        <!-- Categories Url Start -->
        <ul>
        {% for category in categories %}
        <li>
            <a href="{{ category.get_absolute_url }}">{{ category.name }}</a>
            <span>{{ category.count }}</span>
        </li>
        {% endfor %}
        </ul>
        <!-- Categories Url End -->
    </div>
    </div>
</div>
<!-- Categories End -->

It's return an empty list

Also same problem with tags

<!-- Sidebar Tags Start -->
<div class="row block_categories block_sidebar">
    <div class="wighet-title">{% trans "Tags" %}</div>
    <div class="row block_sidebar_content">
    <div class="sidebar_categories">
        {% for tag in tags %}
        <a href="{% url 'djangocms_blog:posts-tagged' tag=tag.slug %}" class="skrolurl">{{ tag.name }} <span>{{ tag.count }}</span></a>
        {% endfor %}
    </div>
    </div>
</div>
<!-- Sidebar Tags End -->
@protoroto
Copy link
Member

Hi! Where are you trying to get the categories list? In which template / plugin?

@hoomanjavadpoor
Copy link
Author

hoomanjavadpoor commented Sep 11, 2023

Hi tnx for your response
i try to place it in post_list.html

@protoroto
Copy link
Member

Ok, because that template is used in a few places: is it the main blog page, or are you using a plugin?
Anyway, you don't have categories (or tags) in the context there, so if you want to display the list of posts categories, you should use BlogCategoryPlugin for the categories, and BlogTagsPlugin for the tags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants