생성일순 정렬

이 테마 컴포넌트 설치

이 컴포넌트는 토픽 목록에 정렬 가능한 생성 날짜 열을 추가합니다. 또한 내비게이션 바에 선택적인 “생성됨(Created)” 탭을 추가합니다.

데스크톱 뷰에서는 전체 열이 추가됩니다. 모바일에서는 “생성됨” 정렬이 선택된 경우에만 활동 날짜와 인라인으로 생성 날짜가 표시됩니다(아래 스크린샷 참조).

:information_source: 이 컴포넌트를 사용하기 전에 커뮤니티가 생성 날짜를 알아야 하는지 평가해 보시는 것이 좋습니다. 특정 시간 내에 새로 생성된 토픽을 자동으로 플래그 처리하는 내장 기능이 이미 존재합니다(설정 > 추적 > 토픽에서 사용자가 커스터마이즈 가능).

설정

생성 날짜 정렬 내비게이션 바 항목 활성화

내비게이션 메뉴에 “생성 날짜로 정렬” 내비게이션 바 항목을 추가합니다. 기본값: true

스크린샷

데스크톱

모바일

생성 날짜 필터에서만 열 활성화

생성 날짜 필터 외부에서 생성 날짜 열이 표시되지 않도록 방지합니다. "생성 날짜 정렬 내비게이션 바 항목 활성화"가 true여야 합니다. 기본값: false

홈 페이지에서 내비게이션 바 항목 활성화

홈 페이지에 “생성 날짜로 정렬” 내비게이션 바 항목을 추가합니다. 기본값: true

홈 페이지에서 열 활성화

홈 페이지에 “생성됨” 열을 추가합니다. 기본값: true

내비게이션 바 항목을 표시할 카테고리

“생성 날짜로 정렬” 내비게이션 바 항목을 표시할 카테고리 목록입니다. 비워 두면 모든 카테고리에서 표시됩니다. 기본값: empty

생성 열을 표시할 카테고리

“생성됨” 열을 표시할 카테고리 목록입니다. 비워 두면 모든 카테고리에서 표시됩니다. 기본값: empty

내비게이션 바 항목을 표시할 태그

“생성 날짜로 정렬” 내비게이션 바 항목을 표시할 태그 목록입니다. 비워 두면 모든 태그에서 표시됩니다. 기본값: empty

생성 열을 표시할 태그

“생성됨” 열을 표시할 태그 목록입니다. 비워 두면 모든 태그에서 표시됩니다.
기본값: empty

내비게이션 바 항목 위치

목록에서 내비게이션 바 항목이 위치할 곳을 조정합니다. 기본값: top.

스크린샷

정렬


모바일 뷰

카테고리 및 태그와 함께

호환성 및 참고 사항

모바일에서는 정렬 기능이 이미 크게 제한되어 있으므로, 생성 날짜는 정보 제공 목적으로만 기능합니다. 생성 날짜가 뱀프(bumped) 날짜와 다를 경우에만 추가 필드가 표시됩니다.

토픽 목록 썸네일과의 호환성은 제한적입니다. 목록 스타일에서는 정상적으로 작동합니다. 블로그 스타일에서는 생성 날짜가 우하단으로 이동합니다. 그리드 스타일과 메이슨리 스타일에서는 “생성됨” 필터가 선택된 경우에만 생성 날짜가 보이며, 활동 날짜를 대체합니다. 미니멀 스타일에서는 생성 날짜가 숨겨집니다.

18개의 좋아요

Wow, another perfect plugin that changes the forum! It would be great if it could integrate with the Discourse Nav Item Icon / Emoji plugin.

3개의 좋아요

I think it should work with it. :slight_smile:
Just add it like for example:
emoji:created_date:twitter:spiral_calendar:filter

5개의 좋아요

Can confirm adding the setting as Don has it does work!


6개의 좋아요

Very nice! Unfortunately it doesn’t play well with the Topic Thumbnails TC, adds an extra time for some reason:

Note the extra 7h at the bottom of the center.

It appears I can just hide this .topic-list .topic-list-data:last-of-type but I thought I would let you know :grin:

EDIT: I found another oddity, when I click Latest, it highlights Created, and when I click Created it highlights latest :zany_face:

1개의 좋아요

Huh. That’s interesting. Looks like it’s just an odd side effect of how the Topic Thumbnails and Created Topic Sort adding to the templates at the same time. Might just be an issue with masonry and grid mode? I’ll see if I can make a suitable adjustment for it in the CSS instead of just hiding it, once i figure out a clean way to detect the theme component usage.

The highlighting for latest and created sounds really weird. Created should only be highlighted when the url has /latest?order=created in it… hmmm…

I’ve updated some of the component to make it prettier for (or at least match) the Topic Thumbnails component.

https://github.com/Alteras1/discourse-created-topic-sort/pull/4

In blog style, the created date is pulled to the bottom right. I couldn’t find a clean way to get it to be right next to the bump date, so this will have to do. In grid style and masonry style, the created date is only visible when the “Created” filter is selected, and will replace the activity date. I tried to get both activity date and created date to display at the same time, but it made the card feel cramped. In minimal style, the created date is hidden.

1개의 좋아요

Would it be difficult to add a category scope to this? We would love to have it on our announcements section but don’t need it displayed in our general discussion, etc.

1개의 좋아요

Not at all! I’ve just pushed out an update that adds four new settings to help control where the nav bar item and column gets displayed.

  • Enable nav bar item in home page: Add the “Sort by Created Date” nav bar item in the home page.
  • Enable column in home page: Add the “Created” column in the home page.
  • Categories to display nav bar item: List of categories to display in the “Sort by Created Date” nav bar item. Leave empty to display in all categories.
  • Categories to display created column: List of categories to display the “Created” column. Leave empty to display in all categories.

https://github.com/Alteras1/discourse-created-topic-sort/pull/7

However, do note that the restrictions on displaying the column only works in sites using the new topic-list changes.

3개의 좋아요

Thank you so much! :star_struck: This is awesome!

Any way to make this the default home page? I’ve seen some plugins add options to the “Top Menu” site setting so I’m thinking it’s possible.

Then I could effectively replace the standard Latest by hiding that one with CSS.

The default homepage can be set with a bit of JS:

import { setDefaultHomepage } from "discourse/lib/utilities";
setDefaultHomepage("/latest?order=created");

Adding the option to the Top Menu settings is definitely preferable, but I don’t think there’s a way to do so from a TC, at least from what I last checked. I’ll have to see if something has changed in the interim.

2개의 좋아요

Thanks! That should work but it appends %3F_discourse_homepage_rewrite to the url which interferes with the sorting. :confounded_face:

2개의 좋아요

I was able to get around that by doing setDefaultHomepage("latest?order=created&");
But now the problem is, even though all the indicators say so, the actual sorting doesn’t apply.

So I tried the same url using Custom Homepage for Groups and that did work :tada: Not sure why that component’s redirect would work differently since I’m pretty sure it using the same method.

2개의 좋아요

figured it out, it needed to clear the PreloadStore

So one can edit your default theme or a new component to add this to the JS:

import { apiInitializer } from "discourse/lib/api";
import { setDefaultHomepage } from "discourse/lib/utilities";
import PreloadStore from "discourse/lib/preload-store";

export default apiInitializer((api) => {
  setDefaultHomepage("latest?order=created&");
  PreloadStore.remove("topic_list");
});

and this CSS to remove the Latest tab:

li.nav-item_latest {
    display: none;
}

Wish it could stay on the root homepage url, but that will probably take a plugin.

3개의 좋아요

Ended up making that plugin: Created as Default Sort Order
So my home page is cleanly sorted by created. I still use this component to add the column.

4개의 좋아요

Thank you for this great theme component!

I’ve made a very small and simple PR that allows to configure where the nav bar item appears.

3개의 좋아요

Thank you for the PR! I’ve gone ahead and merged it and updated the settings description on the OP.

1개의 좋아요

이 기능이 태그 뷰에서도 작동할 수 있을까요? 현재 태그를 열면 생성 메뉴 옵션이 사라집니다. 감사합니다!

업데이트! tags_to_display_nav_bar_itemtags_to_display_created_column 설정이 추가되었습니다.

https://github.com/Alteras1/discourse-created-topic-sort/commit/3eeec4ef68ae83d5789afd4bf501fc8329a9db22

4개의 좋아요