# Different landing page for desktop vs mobile theme?

**URL:** https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019
**Category:** Feature
**Created:** [18.Июнь.2016 23:42:45 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019 "2016-06-18T23:42:45Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![tshenry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tshenry/32/119495_2.png) [@tshenry](https://meta.discourse.org/u/tshenry)
#### Post date: [28.Август.2018 11:06:13 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019/22 "2018-08-28T11:06:13Z")

</div>

No worries. I should have linked to instructions here too! There is a nice illustrated set of instructions you can check out [here](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966#heading--2-5). It’s possible you might be on the latest version of Discourse, in which case the UX for themes and components has changed a little. Let me know if the instructions I linked to still leave you a little lost. I’d be happy to help you figure it out.

By the way, the topic below is the home of this theme component now:

> [@Force Mobile Homepage](https://meta.discourse.org/t/force-mobile-homepage/95705):
>
> Currently the default homepage settings found in the admin panel and user preferences apply to both desktop and mobile. This is a very simple theme component that will allow you to specify a different default homepage for the mobile view of your Discourse forum. It is important to note that this will force mobile to navigate to the homepage you choose in this theme component. Your users will not be able to override the default homepage for mobile via their user preferences at this point. [Repos…](https://github.com/tshenry/discourse-force-mobile-homepage)

---

<div class="post-metadata">

### Author: ![maia\_internet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maia_internet/32/122258_2.png) [@maia\_internet](https://meta.discourse.org/u/maia_internet)
#### Post date: [28.Август.2018 11:15:21 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019/23 "2018-08-28T11:15:21Z")

</div>

thanks @tshenry i’ll take a look.

however I’ve just fiddled round with the customization settings - I’ve never had an issue before, and now my site has disappeared!! Just produces a blank screen, but the code is there!!

any idea how to reverse changes from the cli???

> **[Air Cadet Central](https://forum.aircadetcentral.net)**
>
> serving the Air Cadet Community since 1998

cheers

---

<div class="post-metadata">

### Author: ![tshenry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tshenry/32/119495_2.png) [@tshenry](https://meta.discourse.org/u/tshenry)
#### Post date: [28.Август.2018 11:19:30 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019/24 "2018-08-28T11:19:30Z")

</div>

You’ll need to go to your site’s [safe mode](https://meta.discourse.org/t/53504?silent=true) [Air Cadet Central](https://forum.aircadetcentral.net/safe-mode) and check “disable current theme” then you’ll want to revert whatever change you made in the customizations.

---

<div class="post-metadata">

### Author: ![maia\_internet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maia_internet/32/122258_2.png) [@maia\_internet](https://meta.discourse.org/u/maia_internet)
#### Post date: [28.Август.2018 11:20:40 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019/25 "2018-08-28T11:20:40Z")

</div>

thanks fella - didn’t know that existed! Lifesaver!

---

<div class="post-metadata">

### Author: ![maia\_internet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maia_internet/32/122258_2.png) [@maia\_internet](https://meta.discourse.org/u/maia_internet)
#### Post date: [28.Август.2018 11:28:14 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019/26 "2018-08-28T11:28:14Z")

</div>

OK back up and working - thanks again - I’ve installed your theme and it’s installing as a Theme not a Theme Component??? any ideas. I’m on Version: v2.1.0.beta5 +66

cheers, and thanks for your hard work 😃

---

<div class="post-metadata">

### Author: ![tshenry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tshenry/32/119495_2.png) [@tshenry](https://meta.discourse.org/u/tshenry)
#### Post date: [28.Август.2018 11:31:34 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019/27 "2018-08-28T11:31:34Z")

</div>

No problem. If you select it from the list of themes, then scroll down, you should see a section like this:

 ![52%20AM](https://global.discourse-cdn.com/meta/original/3X/4/e/4e9c13794b82fd78f1a474f112be9cafd690c964.png)

You’ll want to click the “make component” button then confirm. You should then be able to add it to your main theme the way it’s outlined in the instructions I linked to earlier.

---

<div class="post-metadata">

### Author: ![maia\_internet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maia_internet/32/122258_2.png) [@maia\_internet](https://meta.discourse.org/u/maia_internet)
#### Post date: [28.Август.2018 11:39:45 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019/28 "2018-08-28T11:39:45Z")

</div>

Fab, getting there! Making it a component works, but when I add it to my theme it adds a component with the others but there’s no text for the link, but the (x) button is there. The link it produces ends in a # where the others don’t??  
and it doesn’t seem to work!!

Cheers

---

<div class="post-metadata">

### Author: ![tshenry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tshenry/32/119495_2.png) [@tshenry](https://meta.discourse.org/u/tshenry)
#### Post date: [28.Август.2018 11:44:33 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019/29 "2018-08-28T11:44:33Z")

</div>

Ah yeah, I think that might be a little bug that’s still getting worked out. Try refreshing the page, then click the (x) if that blank theme component is still there, then try selecting the Force Mobile Homepage component again. You might also try selecting another theme component from the dropdown list, then open the list again and select the Force Mobile Homepage component again. Click the “add” button and hopefully that should do it!

---

<div class="post-metadata">

### Author: ![maia\_internet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maia_internet/32/122258_2.png) [@maia\_internet](https://meta.discourse.org/u/maia_internet)
#### Post date: [28.Август.2018 11:46:59 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019/30 "2018-08-28T11:46:59Z")

</div>

You are indeed a hero - now working as advertised! Many thanks for your help today, greatly appreciated!

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [28.Август.2018 14:02:20 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019/31 "2018-08-28T14:02:20Z")

</div>

> [@maia\_internet](#):
>
> there’s no text for the link, but the (x) button is there.

Yes, I’ve come across this several times. Has this been reported I wonder?

---

<div class="post-metadata">

### Author: ![maia\_internet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maia_internet/32/122258_2.png) [@maia\_internet](https://meta.discourse.org/u/maia_internet)
#### Post date: [28.Август.2018 14:33:19 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019/32 "2018-08-28T14:33:19Z")

</div>

I don’t know - I haven’t - but @tshenry 's suggestion of moving in and out of the drop down menu after a page reload worked.

---

<div class="post-metadata">

### Author: ![MartyMeh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martymeh/32/113462_2.png) [@MartyMeh](https://meta.discourse.org/u/MartyMeh)
#### Post date: [12.Январь.2019 00:06:00 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019/33 "2019-01-12T00:06:00Z")

</div>

Nice one! thanks @tshenry ❤

---

<div class="post-metadata">

### Author: ![msinger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/msinger/32/144985_2.png) [@msinger](https://meta.discourse.org/u/msinger)
#### Post date: [29.Июнь.2019 02:33:18 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019/34 "2019-06-29T02:33:18Z")

</div>

Есть ли причины не объединить ваш скрипт со следующим в разделе Настройка → Темы → Мобильная версия → Заголовок?

```
<script>
  if (window.location.pathname == "/")
  { window.location.href = "/latest";
  }
</script>

```

Это обеспечит начальное перенаправление на /latest, если пользователь попадает на главную страницу.

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [29.Июнь.2019 02:55:46 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019/35 "2019-06-29T02:55:46Z")

</div>

Нет, особой причины нет. Тем не менее, я больше не использую этот скрипт. С добавлением возможности выбора домашней страницы пользователем я просто предлагаю тем, кто предпочитает `/latest`, выбрать её.

---

<div class="post-metadata">

### Author: ![msinger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/msinger/32/144985_2.png) [@msinger](https://meta.discourse.org/u/msinger)
#### Post date: [29.Июнь.2019 11:47:08 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019/36 "2019-06-29T11:47:08Z")

</div>

Изначально я нашел эту тему, когда искал решение своей проблемы:

> [@How to default to latest on mobile and categories+latest on desktop?](https://meta.discourse.org/t/how-to-default-to-latest-on-mobile-and-categories-latest-on-desktop/55716):
>
> Is there a way to default the frontpage to display latest page on mobile, while on desktop displaying the categories+latest combined view? I’m currently trying to figure this out.

Как объясняется в теме, я настроил свой форум так, чтобы отображались категории + последние сообщения, поскольку хочу показывать не только последние обсуждения на рабочем столе. Вот два параметра Discourse, которые делают такой макет возможным:

 ![image](https://global.discourse-cdn.com/meta/original/3X/4/a/4a03157581d87a9bdb49064db9c70bec86f6e672.png)

Это идеальный макет для меня: он показывает категории пользователям, которые хотят создать новую тему, и при этом предоставляет последние обсуждения тем, кто просто возвращается, чтобы узнать, что нового.

Для всех, кто читает это и хочет сделать то же самое, вот что нужно сделать:

1. Перейдите в раздел **Редактировать CSS/HTML** вашей темы:

2. Добавьте следующий скрипт в раздел **Мобильные** → **Заголовок** (так чтобы он влиял только на посетителей с мобильных устройств):

  

**Обновление:** Компонент темы [Принудительная мобильная главная страница](https://meta.discourse.org/t/force-mobile-homepage/95705), на который есть ссылка выше, вероятно, является лучшим способом решить эту задачу.

---

<div class="post-metadata">

### Author: ![Paracelsus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paracelsus/32/164912_2.png) [@Paracelsus](https://meta.discourse.org/u/Paracelsus)
#### Post date: [09.Январь.2020 08:11:02 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019/37 "2020-01-09T08:11:02Z")

</div>

Возможно ли реализовать эту функцию для каждого пользователя отдельно? Например, чтобы каждый пользователь мог выбрать свою стартовую страницу на мобильных устройствах в настройках интерфейса (там уже есть общая настройка, нам понадобится только отдельная для мобильных устройств).

---

<div class="post-metadata">

### Author: ![sbernhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sbernhard/32/208186_2.png) [@sbernhard](https://meta.discourse.org/u/sbernhard)
#### Post date: [04.Август.2020 20:27:09 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019/38 "2020-08-04T20:27:09Z")

</div>

У меня сейчас та же проблема: на рабочем столе я предпочитаю вид категорий, где последнее обсуждение отображается справа. На мобильных устройствах вид категорий показывает только сами категории. На мобильных я бы предпочел вид «последние изменения в обсуждениях».

Было бы здорово иметь две настройки:

- домашняя страница по умолчанию на рабочем столе: [поле выбора]
- домашняя страница по умолчанию на мобильных устройствах: [поле выбора]

Можно ли будет принять PR с такой доработкой?

---

<div class="post-metadata">

### Author: ![Tomas\_Hnyk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tomas_hnyk/32/217289_2.png) [@Tomas\_Hnyk](https://meta.discourse.org/u/Tomas_Hnyk)
#### Post date: [10.Июль.2021 15:33:25 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019/39 "2021-07-10T15:33:25Z")

</div>

Может ли это быть также настройкой на уровне устройства? Предложенные выше обходные пути не идеальны, поскольку они навязывают настройку всем мобильным пользователям (при этом планшеты в этом отношении сложно классифицировать). И вполне очевидно, что часто может иметь смысл иметь разные предпочтения в зависимости от устройства, а не только различие между настольными компьютерами и мобильными устройствами.

---

<div class="post-metadata">

### Author: ![pedroponte](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pedroponte/32/254189_2.png) [@pedroponte](https://meta.discourse.org/u/pedroponte)
#### Post date: [24.Март.2022 22:57:26 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019/40 "2022-03-24T22:57:26Z")

</div>

Это лучшее изобретение после колеса! Спасибо, брат!

---

<div class="post-metadata">

### Author: ![Michele\_Butturini](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michele_butturini/32/295242_2.png) [@Michele\_Butturini](https://meta.discourse.org/u/Michele_Butturini)
#### Post date: [29.Апрель.2023 14:58:20 UTC](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019/41 "2023-04-29T14:58:20Z")

</div>

Мне бы очень хотелось иметь такие же настройки… Есть ли способ это сделать?

[Previous page](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019.md?page=1)

[Next page](https://meta.discourse.org/t/different-landing-page-for-desktop-vs-mobile-theme/46019.md?page=3)
