איך להחליף/לדרוס תבנית דף הבית

I would like to configure different custom homepages for logged-in and non-logged-in users. While I am aware that this can be implemented using JavaScript, I am interested in knowing whether it can also be achieved through a Discourse component or plugin.

I have come across the component User-specific Discourse home page, which allows creating a new route and adding a template, but I would prefer not to use that approach.

If there are any alternative suggestions or recommended best practices, I would greatly appreciate your guidance.

לייק 1

A discourse component is written in JavaScript :wink:

There is custom home page support for developers and you could differentiate between those types of users.

3 לייקים

תודה על תגובתך. ניסיתי את הגישה המוזכרת במאגר ה-GitHub על ידי הוספת \"custom-homepage\": true לקובץ about.json של הערכה שלי, אך זה לא נראה שעובד. האם תוכל לאשר אם זו השיטה הנכונה?

אני מציע לפתוח דיון ב-Dev

אם אתה מתקשה, שקול לשכור מפתח Discourse מנוסה ב-Marketplace

לייק 1

It’s the correct method, have you followed all of the steps? after adding

  "modifiers": {
    "custom_homepage": "true"
  }

and enabling your theme, do you see this as your homepage?

כן, עקבתי אחר השלבים שניתנו בשרשור. באופן ספציפי, הוספתי תחילה \"custom-homepage\": \"true\" ב-modifiers, ואז יצרתי רכיב ב-javascripts/discourse/connectors/custom-homepage/home.gjs.

האם אתה עדיין רואה את דף הבית המוגדר כברירת מחדל? או שאתה רואה דף בית ריק? האם יש שגיאות קונסול?

כן, אני רואה את דף הבית ברירת המחדל שלי ואין שגיאות בקונסול

You probably need to change this setting:

image

in preferences

2 לייקים

עכשיו הבנתי, אני צריך להגדיר את דף הבית כברירת מחדל ואז זה עבד

לייק 1

תודה על תגובתך

לייק 1

תודה על תגובתך זה עבד, הייתי צריך רק להגדיר את הגדרת דף הבית המוגדר כברירת מחדל לברירת מחדל.

2 לייקים

הנושא נסגר אוטומטית 30 דקות לאחר התגובה האחרונה. לא ניתן להוסיף תגובות חדשות.