saish
9월 5, 2025, 10:06오전
1
로그인 상태와 미로그인 상태의 사용자에게 각각 다른 사용자 지정 홈 페이지를 구성하고 싶습니다. JavaScript를 사용하여 구현할 수 있다는 점은 알고 있지만, Discourse의 컴포넌트나 플러그인을 통해서도 이를 달성할 수 있는지 궁금합니다.
새로운 라우트를 생성하고 템플릿을 추가할 수 있는 사용자별 Discourse 홈 페이지 컴포넌트를 확인했지만, 해당 방식을 사용하고 싶지는 않습니다.
대안이나 권장되는 모범 사례가 있다면 조언을 주시기를 부탁드립니다.
디스커스 컴포넌트는 JavaScript로 작성됩니다
개발자를 위한 커스텀 홈 페이지 지원이 있으며, 이러한 사용자 유형을 구별할 수 있습니다.
main ← dynamic-route-exp
merged 03:05PM - 02 Apr 24 UTC
This PR adds a theme modifier and route so that custom themes can opt to show th… eir own homepage. To use it, do the following:
### 1. Add a modifier to your theme (or component) for `custom_homepage`
```json
{
"name": "Your theme name",
"component": true,
"modifiers": {
"custom_homepage": "true"
}
}
```
### 2. add a component in the `custom-homepage` connector.
By default, when the modifier is added, admins will see an info alert as the homepage:
<img width="1419" alt="image" src="https://github.com/discourse/discourse/assets/368961/4102c4e8-0111-4bc5-af82-74d4440d0559">
Themes or plugins can add elements to the `custom-homepage` plugin outlet. For example, a theme can add a file under `javascripts/connectors/custom-homepage/home.hbs` containing "Hey there!", and the homepage will display that component:
<img width="1348" alt="image" src="https://github.com/discourse/discourse/assets/368961/72e900f6-1361-4419-a49d-190395a5d4e5">
Note that this theme modifier respects the user's selected homepage (from Preferences > Interface), if the user has picked a specific route as their homepage, that route will be shown to them.
saish
9월 5, 2025, 1:37오후
4
답변해 주셔서 감사합니다. GitHub 저장소에 언급된 방법을 시도하여 테마의 about.json 파일에 "custom-homepage": true를 추가해 보았지만, 작동하지 않는 것 같습니다. 이것이 올바른 방법인지 확인해 주실 수 있을까요?
#dev에서 새 주제를 개설하는 것을 제안합니다.
고민이 많다면 #marketplace에서 숙련된 Discourse 개발자를 고용하는 것을 고려해 보세요.
올바른 방법입니다. 모든 단계를 따르셨나요? 다음을 추가한 후
"modifiers": {
"custom_homepage": "true"
}
테마를 활성화하면 이것이 홈페이지로 보이나요?
saish
9월 5, 2025, 1:44오후
7
네, 스레드에 제시된 단계를 따랐습니다. 구체적으로, 먼저 modifiers에 "custom-homepage": "true"를 추가하고, 그 다음 javascripts/discourse/connectors/custom-homepage/home.gjs에 컴포넌트를 생성했습니다.
기본 홈페이지만 보시나요, 아니면 빈 홈페이를 보시나요? 콘솔 오류가 있나요?
saish
9월 5, 2025, 1:58오후
9
네, 제 기본 홈 페이지가 표시되고 콘솔에 오류는 없습니다.
saish
9월 5, 2025, 2:16오후
11
이제 알았어요. 기본 홈 페이지를 default로 설정해야 했네요. 그렇게 하니 작동했어요.
saish
9월 5, 2025, 2:19오후
13
답변해 주셔서 감사합니다. 문제가 해결되었습니다. 기본 홈페이지 설정을 기본값으로 변경하면 되더군요.