强制移动首页

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.

Repository Link
https://github.com/tshenry/discourse-force-mobile-homepage

I don’t know if there’s anything to gain by including screenshots or putting a demo on theme-creator, but if anyone thinks otherwise, please speak up!

Theme Settings

There is one setting that allows you to set the mobile homepage as:

  • latest (default)
  • categories
  • new
  • unread
  • top

Installation

If you are new to installing theme components, check out @Johani’s excellent guide on theme components, particularly how to import a theme component and how to add the theme component to your main theme.

Future

  • Allow users to override the default we set in this component.

That’s it! Questions, comments, and suggestions are always welcome :slight_smile:

56 个赞

Works like a charm. This is great mate!

4 个赞

Great little component, just what I needed for my community!

Many thanks.

1 个赞

Can you please integrate this into core settings.

Sitewide default in settings for mobile and desktop.

And user setting in user profile settings for mobile and desktop.

:wink:

9 个赞

+1 for having different home page capabilities for mobile and desktop in core.

10 个赞

Thank you for this useful component.
Could you please help? While showing “Latest” by default on mobile, there is no option to choose “Categories” in top drop-down menu above topic list.

Exactly what I was after - thank you for this little component!

3 个赞

太棒了,谢谢 :folded_hands::folded_hands::folded_hands::folded_hands:

1 个赞

谢谢你创建这个!:handshake: 随着 Discourse 主应用程序的不断发展和更新,未来的兼容性如何?或者主题组件在这方面是否相当面向未来?

2 个赞

我认为这个主题组件非常简单,而且几乎坚不可摧!只需要几行 CSS 和 HTML 代码,没有任何设置或花哨的东西。

3 个赞

我仍然认为这应该作为一项附加设置合并到核心中,它非常有用!

10 个赞

一个很棒且简单的小组件。

当然,我们的高级用户立刻开始提出要求,希望允许他们设置自己的覆盖首选项。

这可以满足绝大多数普通用户的需求,但对于排名前 1% 的高级用户来说,仍然存在个人覆盖的需求。

同意。它已经7年没有更新了,但仍被Discourse的拥有者使用。

1 个赞

1 个赞

更新的希望

这是必备插件之一,需要更新!:folded_hands:

我已在此处的 PR 中更新:DEV: update to initializer by awesomerobot · Pull Request #3 · tshenry/discourse-force-mobile-homepage · GitHub

@tshenry 你有空时能否看一下并合并?

6 个赞

合并了!感谢你的 PR!

7 个赞

我在浏览器的开发者控制台中收到了关于这个很棒的主题组件的弃用通知:

[THEME 50 ‘Force Mobile Homepage’] 弃用通知:在站点初始化期间访问 site.mobileViewsite.desktopView 可能会在浏览器窗口大小调整时导致错误和不一致。请将这些检查移至在页面渲染期间执行的组件、转换器或 API 回调。 [自 Discourse 3.5.0.beta9-dev 起已弃用] [弃用 ID:discourse.static-viewport-initialization] [信息:Designing for Different Devices (Viewport Size, Touch/Hover, etc.)]

2 个赞

是的,情况相同,这也是我仅剩的几条折旧通知之一……

1 个赞