배너가 포함된 카테고리 목록

이 컴포넌트는 기본 카테고리 페이지 스타일인 Categories OnlyCategories With Featured Topics에 선택적인 배너를 추가합니다:

컴포넌트 설정에서 배너 바로 아래에 카테고리를 지정하고, 배너 색상 및 제목 텍스트를 정의하여 배너를 추가할 수 있습니다. 기본 색상 테두리를 숨기는 옵션도 있습니다:

스타일을 추가하려면 일반 클래스를 선택하거나, 카테고리 ID별로 특정 배너를 선택할 수 있습니다:

.category list .category-list-banner {
  &.category-5 { [style a specific banner] }
  &:after { [style the headings]}
}

예를 들어 카테고리를 색상 코드로 구분할 수 있습니다:

또는 배경 이미지를 추가할 수 있습니다:

:warning: 이 컴포넌트는 카테고리 페이지에 레이아웃 요소만 추가합니다. 따라서 사이트의 다른 곳에서 이러한 제목을 참조할 수 없습니다. 주의할 점: 모바일에는 Categories Only라는 기본 페이지 스타일이 없습니다. 항상 추천 주제(Featured Topics)도 함께 표시됩니다.

:+1: 크레딧: 이 컴포넌트는 Cfx.re Community의 디자인과 @godgutten이 How do I add category banners?에서 공유한 해당 룩을 구현하기 위한 원래 솔루션에서 영감을 받았습니다.

28개의 좋아요

Thank Nolo Very cool! Your component has improved our community

1개의 좋아요

Nolo, I found another problem with switching the forum style to night mode. If you can fix it, it will be perfect!

That looks like expected behavior.. The color slot takes any value that you can use as background-color in CSS. So when you give a hex value, it will stay the same color in different modes and themes.

If you actually don’t want a background color, you should state none or transparent.

If you want a background color that changes with modes, you’d need to state it with a CSS custom property: you could use one of Discourse’s pre-defined ones like var(--secondary-high). Or define some yourself, as explained in

3개의 좋아요

Nolo, thanks, that helped!

2개의 좋아요

Hello I love to see what you have managed to create. But it is allowed to give credit to me also and not only ripp me off and use some of my work…..

Happy you l ike the component! Not sure why you accuse me for ripping you off by using your work though..?

Doing this component was inspired by this topic:

I had referred the op to your solution, but then got interested how to solve this without hard-coding the templates and by de-constructing values from a settings list within scss. So the component code is essentially all about this solution:
https://meta.discourse.org/t/how-to-add-settings-to-your-discourse-theme/82557/52?u=nolo

But in any case: if you feel I used some of your work and I missed to give credits, kindly let me know and I’ll update the first post :ok_hand:

1개의 좋아요

Yes please would love to get at least some kind of creds. But it’s up to you tho. Other than that it looks good and I’m going to recommend this theme component in my post since this makes it easier for new users.

2개의 좋아요

@ Nolo
Is there a way in the TC, or with CSS in the theme to left align the Heading text, just like your second example).

also is there a way (if not using a banner image) to resize the header to just the thickness of a line of text.
And if so, can you resize the text so it’s not quite as large?

2개의 좋아요

Yeah sure, you can style the banners using these classes:

If you want to overwrite existing declarations on the general class you’d need to use the !important property. E.g. for the styles you mentioned:

.category-list .category-list-banner {
    justify-content: flex-start !important;
    min-height: unset !important;
    &:after {
        font-size: var(--font-up-3) !important;
    }
}

That’s because the styles are actually declared on the specific banners. Guess I could improve that on the component, but for now you’d need to overwrite with important.

3개의 좋아요

Thank you so much for this component!! I’m developing a political forum, and being able to apply this kind of separation is critical.
While it’s already a huge improvement for my forum, It would be a world of a difference if the headers could be referenced by URL, because that would allow to create buttons at the top of the forum from which the user could be able to easily navigate in the same page. That would be extremely agile functionality if the forum (hopefully) gets a lot larger. Is it currently possible?

1개의 좋아요

Thanks for the suggestion @lisandro_iaffar. Though this component is really just providing a lightweight solution that doesn’t change html templates. If you want to reference the sections you’d need to use an approach as offered by GitHub - discourse/discourse-minimal-category-boxes · GitHub.

2개의 좋아요

Thank you for your answer and for providing guidance :slight_smile:
And thank you again for this component, it just improved my forum layout so much :smiley:

2개의 좋아요

I’m excited to try this as I have created a bit too many categories and being able o organize them in groups will be a big help.

I will know when I try, this too then could be a way to leave old, lesser used categories off the front page, right? They would still be available via the new sidebar.

1개의 좋아요

Yes, sure :+1: Actually I almost always make selections of categories on different page elements (sidebar, header, navbar, category page,..) It’s like the site structure of a website. It’s important that it’s well organized, but it doesn’t need to determine your ui presentation.

Hello @manuel I would like to know if this wonderful component still works after the speech updates, I installed it and it doesn’t work for me, thanks advanced

how do you add background images ?

Hi, welcome :wave:

You can add CSS in your themes or a separate theme component:

For example, assuming you want to add an image to the category ID 4, you would do something like that:

.category-list .category-list-banner {
    &.category-4 {
        background-image: url(https://images.unsplash.com/32/Mc8kW4x9Q3aRR3RkP5Im_IMG_4417.jpg);
        background-size: cover;
    }
}

This is just an example. For more information, you can look at the background CSS properties.

Also helpful links :+1: :

2개의 좋아요

A post was split to a new topic: Add extra info to category box

Category List Banner 컴포넌트에서 현재 다음과 같은 경고가 표시됩니다.

[관리자 알림] 테마 'Category List Banners’에는 업데이트가 필요한 코드가 포함되어 있습니다. (id:discourse.hbs-extension) (자세히 보기)

이것은 2026년 3월에 발표된 공지 사항과 관련이 있습니다.

1개의 좋아요