יצירת דף בית מותאם אישית עם מסננים

האם אוכל ליצור דף בית דינמי כמו זה:

  • 10 הנושאים הפעילים ביותר לאחרונה (השבוע)
  • 5 הנושאים החדשים ביותר שנוצרו (היום)
  • 5 נושאים עדכניים יותר (השבוע)
  • 5 הנושאים עם הכי הרבה תגובות (השבוע)
  • 5 הנושאים עם הכי הרבה לייקים (השבוע)
  • 5 הנושאים החדשים ביותר שנוצרו (אתמול או היום)

ישנו רכיב עיצובי שדרכו אוכל ליצור דף בית כזה ב-Discourse Filtered Topics List, אבל אני מרגיש שהחיסרון הוא שהוא עובד רק עם מסגרת זמן מסוימת, אז אצטרך לשנות את מסגרת הזמן מדי יום.

אני מתכוון, לעת עתה, זה עובד על בסיס שאני יכול להוסיף תאריכים, כמו:

activity-before:YYYY-MM-DD נושאים עם עדכון אחרון לפני התאריך שצוין
activity-after:YYYY-MM-DD נושאים עם עדכון אחרון אחרי התאריך שצוין
created-before: YYYY-MM-DD נושאים שנוצרו לפני התאריך שצוין
created-after:YYYY-MM-DD נושאים שנוצרו אחרי התאריך שצוין

אבל אז אני תמיד אצטרך לשנות תאריכים. האם יש אלטרנטיבה שאני יכול לעשות בפורום?

2 לייקים

כמו כן, הבעיה העיקרית ברכיב הזה היא שהוא חוזר על נושאים בכל מיון

Does your case require these to be literally most replies/likes? If you use the /top topic list you can get automatic time periods… top factors in views, likes and post count (and you can adjust these weights a little bit with site settings)

Right this is a complication with sourcing multiple topic lists, a component would need to cross reference each list and remove duplicates. Not very complicated, but I don’t think this has been implemented in any available components.

לייק 1

לא לגמרי על תגובות ולייקים אבל כן, רק מנסה ליצור דף בית דינמי למראה.

אז, רכיב שיכול להסיר את הנושא הכפול מכל אחד מהשדות יעשה את העבודה?

Yeah it wouldn’t be too complicated to add a “hide duplicates” feature to Filtered Topic Lists, if @gormus is interested. The findFilteredTopics action could be modified to store every topic ID in a list, and then duplicates could be filtered out.

The downside is that if you want a list of 10 topics, you might only get 5 after duplicates are removed… but that could be partially avoided by maybe fetching a few extra beyond what was specified in the setting.

לייק 1

I’ve added filtered lists to homepages on several projects before and I’d caution that to populate multiple “most recent” lists with overlapping filters, you really need a very active community to begin with. Now when your community is that active, you’ll also have a much richer set of content to work with for building a dynamic homepage. In that case, a block of different lists might rather come off as static and not so visually appealing.

Though for a slightly different angle, you could also explore just putting one or two lists with a manual time filter. That could even feel more dynamic for the users. As in this view:

That’s a feature I took from the Central theme and it’s available here as a block component: Manuel Kostka / Discourse / Blocks / Top Topics · GitLab

4 לייקים

נכון, זה עשוי לעבוד, אבל למעשה רציתי לאכלס מספר מסננים בדף.

2 לייקים

כן, זה באמת עובד. אם @gormus יהיה מעוניין :))

I’ve made an update today that will help with this a little bit: FEATURE: allow date-based filters to accept a day count by awesomerobot · Pull Request #33197 · discourse/discourse · GitHub (you should get this the next time you update Discourse)

This will allow you to enter your desired number of days into the activity/created-before/after filters, so you can do:

activity-after:7 topics active the last 7 days
created-after:1 topics created after 1 day ago

You can also use 0 for today (as in after midnight)

7 לייקים

לעזאזל, זה היה מהיר. תודה!!

2 לייקים

היי @awesomerobot, רק רציתי לעדכן אותך שביצעתי את השינויים הנדרשים וזה עובד מצוין עכשיו. תודה :))

לייק 1

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.