Discourse 文档分类

||||
-|-|
:discourse2: | 摘要 | Discourse Doc Categories 允许将特定类别预留用于文档,从而为其启用额外功能。
:hammer_and_wrench: | 仓库链接 | https://github.com/discourse/discourse-doc-categories
:open_book: | 安装指南 | 如何在 Discourse 中安装插件

:warning: 请注意,此插件正处于积极开发中,尚未完全完成。

功能

Discourse Doc Categories 插件允许您在现有的 Discourse 论坛中托管结构化文档。它通过预留特定类别用于文档,并提供功能以便更容易查找特定文档主题来实现这一目标。

您可以在 Documentation 类别中看到它的实际效果。

当将某个类别标记为文档位置时,该类别将启用以下功能:

  • 指定一个主题作为该类别中所有文档主题的索引
  • 一个新的侧边栏,用于在类别内的不同主题之间导航,包括内置的过滤和搜索功能
  • 新的报告,帮助您维护索引主题的一致性

此外,该插件还处理从 已停用的 Docs 插件 迁移的站点的重定向。来自该插件的文档链接将重定向到其现有的主题 URL,并且有一个设置用于将您之前的文档主页重定向到您的主文档类别。

配置

配置设置位于 example.discourse.com/admin/site_settings/category/doc_categories。在这里您将找到以下设置:

  • doc categories enabled:选择以启用 Doc Categories 插件。
  • doc categories docs legacy enabled:如果您已从弃用的 Docs 插件迁移,请选择此项。
  • doc categories homepage:启用上一个设置后,弃用的 Docs 插件的着陆页将重定向到此 URL。

要指定哪些类别将用于文档,请为其分配一个索引主题。为此,通过点击类别页面上的 :wrench: 图标打开类别的设置。从那里,点击“Settings”链接并向下滚动到“Documentation mode”部分。使用“Index topic”字段指定将用作该类别索引的主题。

索引主题

文档类别的索引主题有两个用途:

  1. 它们是类别中包含的所有主题的中心列表
  2. 与此插件一起包含的侧边栏由索引主题内容填充

格式化索引主题

索引主题可以包含您喜欢的任何内容。为了使侧边栏正常工作,它们需要包含一个项目符号列表(或多个项目符号列表)的文档主题。这些可以简单地是列表中的主题 URL,在这种情况下,侧边栏将显示每个文档主题的完整标题。

如果标题超过几个字,在侧边栏中显示完整标题可能不太实用,因此要为特定主题设置较短的标题,请在 URL 前加上缩短的标题后跟冒号 (:)。冒号之前的所有文本将在侧边栏中显示,并链接到主题 URL。

您可以将索引主题划分为多个部分,并在每个部分上方使用带有标题(任何级别)的多个列表——它们将在侧边栏中按这些部分显示。

以下是一个索引主题的示例,供您参考:

您可以从可选的类别简要描述开始。

## 第一部分
* https://discourse.example.com/t/topic-title/12
* https://discourse.example.com/t/another-topic-title/34
* 短标题: https://discourse.example.com/t/topic-with-a-long-title/56
* 另一个标题: https://discourse.example.com/t/another-topic-with-a-long-title/78

## 第二部分
* 主题标题: https://discourse.example.com/t/documentation-topic/98
* https://discourse.example.com/t/new-topic/76

该示例将输出如下所示的文档侧边栏:

:eyes: 查看 Documentation > Site Management 索引主题,以了解文档类别索引的实际效果: https://meta.discourse.org/t/site-management-index/308032

维护索引主题

虽然索引主题不会随着类别中内容的添加、删除或编辑而自动更新,但该插件包含新的报告,突出显示索引主题中不一致的地方。

  • 未索引的主题:
    example.discourse.com/admin/reports/doc_categories_missing_topics
    此报告显示文档类别中未添加到索引的任何主题。

  • 多余的项目:
    example.discourse.com/admin/reports/doc_categories_extraneous_items
    此报告显示索引中包含的看起来不应该存在的项目。报告将指示主题被包含在报告中的原因——例如,如果它已被删除或它位于与其包含的索引主题不同的类别中。

附加信息

在搜索词中添加字符串 in:docs 将搜索所有标记为文档的类别(即已分配索引主题的类别)。

索引中的最大项目数由 Max oneboxes per post 站点设置设置,默认值为 50。如果您需要超过 50 个索引项目,请增加该设置中的数字。

38 个赞
New documentation plugin in development
Discourse vs Skool
Discourse Docs
How to create a sidebar similar to meta documentation sidebar?
Using Discourse as Learning Platform
Sub-sections on the sidebar without sub-categories
I am very interested in the 'documentation' feature
Using Discourse as an enterprise wiki library
How to arrange sub categories as list items under a category
Sub-sections on the sidebar without sub-categories
Custom topic ordering
Collections
Bulk Export of Raw Post Sources with Markup
Bulk Export of Raw Post Sources with Markup
Discourse Doc Categories is now available on Business
Discourse Docs
Discourse as an LMS / Discourse integration with an LMS
Topics (with replies) bumped on title edit
Theme customize - sidebar content
Questions about subcategories displaying in wiki sidebar
Doc pages - Schema Article
Structuring an active support community migrating from Facebook
Introducing simple mode for Discourse Doc Categories
Sidebar activation issues after recent Doc Categories update
How to add this header, colored categories, and sidebar categories?
What is the best way to Publish a book with chapters?
Sidebar spacing change?
Is there a plugin that allows you to organize all the URLs of a category into one topic?
Use more often placeholder forms in documentation topics?
Published Pages for documentation?
Need Help on Category on left sidebar
Displaying "full topic" text on category page + access to subcategory from menu bar
Custom Platform
Click a category to open a subcategory page
Discourse Doc Categories links not rendering
A better way to manage indices for Doc Categories?
A better way to manage indices for Doc Categories?
Create index topic

这相当不错……我一直在关注其他的自托管文档解决方案(论坛结构有时对新读者来说有点令人困惑)。

祝 Discourse 好运(对抗 Gitbook 和其他产品 :smiley:

6 个赞

我猜组件 discourse-doc-sidebar(我记得名字对吗?)不再需要了?

3 个赞

是的,最初为新文档侧边栏构建的组件已移至此插件。

4 个赞

我猜这不再支持标签了? :slight_smile:

4 个赞

我喜欢这种方法,因为它能很好地融入核心的讨论导航,而不是像 Docs 插件那样全新创建一个。
我们很乐意进行切换!

2 个赞

我只是在这里放一下,完全不是本地功能请求。即使这些可能不专门应用于此插件,但我确实认为它们是任何文档环境中极佳的功能——作为一项优势,它们也可以成为核心的绝佳补充。 :thinking:

5 个赞

类似于脚注功能,但全局关键字触发对于这种功能来说将是史诗级的。

3 个赞

如果我们拥有悬停预览,即显示在你论坛的任何内部链接上,你甚至都不需要这个,单词/链接替换可以处理这个问题,只需将鼠标悬停在某个单词上即可阅读完整帖子而无需打开它 :smiley:

像这样的功能非常方便(因为没有人喜欢阅读文档,对吧?),并且随着这个插件的发布,在我寻找托管文档的最佳解决方案的过程中,这让我更加难以抉择 :stuck_out_tongue: 我正在探索将我的文档迁移到 Quartz,内容管理在 Obsidian 中。

2 个赞

它有可能与 3.3 稳定版兼容吗?

3 个赞

是的,这与 Discourse 3.3 完全兼容 :slight_smile:

2 个赞

不,不是这样的:

/var/www/discourse/plugins/discourse-doc-categories/lib/doc_categories/initializers/invalidate_cache_on_enabled_setting_change.rb:8:in `apply': undefined method `on_enabled_change' for an instance of Plugin::Instance (NoMethodError)

** 不兼容的插件 **
由于插件 /var/www/discourse/plugins/discourse-doc-categories 中存在错误,您无法启动 Discourse。

请参阅 DEV: Add plugin API to perform actions when the plugin is turned on/o… · discourse/discourse@366dfec · GitHub

4 个赞

标题和侧边栏中的表情符号渲染将非常棒!

3 个赞

大家好!

抱歉,这是我的错误。

休(Hugh)问我插件是否兼容时,我犯了个错误,以为我在开发过程中在核心中引入的新 API 已经进入了 3.3 稳定版。

不幸的是,事实并非如此,插件兼容的第一个稳定版本将是 3.4。

再次为造成的困惑表示歉意。

6 个赞

组标签和标签怎么样?

3 个赞

感谢您的澄清,@saquetim

我不确定您的意思——您能再解释一下吗?

Docs 插件,我们可以在侧边栏中按组显示标签以进行筛选。
有了新插件,我们能做同样的事情吗?

2 个赞

新插件目前无法做到这一点。这可能是我们将来会探索的内容,但目前我们不会将其添加到其中。

2 个赞

是的,是的
非常感谢!

1 个赞

我一定很笨,但我相信我做对了一切,我将一个主题命名为类别索引,并将文档插件指向该主题,但我仍然看不到侧边栏。是否有带有截图的分步演示?我绞尽脑汁想设置一个文档类别。谢谢!

1 个赞