Discourse Docs (Documentation Management)

:discourse2: Summary Discourse Docs provides the ability to find and filter knowledge base topics
:hammer_and_wrench: Repository Link https://github.com/discourse/discourse-docs
:open_book: Install Guide How to install plugins in Discourse

Features

The Discourse Docs plugin is a powerful tool that transforms your Discourse forum into a community-powered knowledge base. It provides a dedicated Docs section where users can create, update, and curate documentation. This plugin features a Docs button that allows easy access to this section. It’s a great way to leverage the collective knowledge of your community and provide a centralized resource for important information.

You can see it in action at https://meta.discourse.org/docs.

In essence, Docs allows for easier surfacing of knowledge-base style topics across a defined set of categories and/or tags.

Filter the list down by tags, search via the search bar, and click on topics to see the first post – all without leaving the context of the knowledge explorer.

Need to find a knowledge base topic from somewhere else in Discourse? Use the new search helper: in:kb.

Configuration

  1. Enable the plugin by turning on the docs enabled setting.

  2. Add categories and tags to the docs categories and docs tags settings.

  3. Find the Docs link in the navigation menu.

Screen Shot 2021-03-01 at 12.49.14 PM

  1. Profit with easier access to knowledge!

Settings

Name Description
docs enabled Enable the Docs Plugin
docs categories A list of category slugs to include in docs
show tags by group Organize tags using Tag Groups. Create groups to categorize related tags.
docs tag groups The Tag Groups used to show tags by group
docs tags A list of tags to include in docs
docs add solved filter Adds a filter for solved topics – requires Discourse Solved to be installed and enabled
docs add to top menu Adds a link to the top menu to navigate to the Docs view
docs add search menu tip Adds the tip “in:docs” to the search menu random tips

Helpful Pairings

Renaming the /docs path

If you have access to your server you can change the path of your /docs link by adding a DISCOURSE_DOCS_PATH: environment variable to your app.yml:

For the change to take effect you can either ./launcher rebuild app or, as it’s an environment variable, you can ./launcher destroy app && ./launcher start app to minimise downtime. There’s a little more info on that here - Set Environmental Variables

You may also want to change the site display text as well to match. You can search for all instances of ‘docs’ from your /admin/customize/site_texts page, but the main ones would be:

  • js.docs.title
  • js.sidebar.docs_link_text

:discourse2: Hosted by us? Renaming the /docs path is only available on our Enterprise plan. Please contact us if you’d like to learn more.

Development History

The Docs plugin was a continuation from the Knowledge Explorer Theme Component.


:discourse2: Hosted by us? This plugin is available on all of our hosting plans. Docs | Discourse - Civilized Discussion

91 Likes

Hi Discourse community,

I got below error when executing the spec. I didn’t change any files. Can I ignore this error?

➜  discourse git:(main) ✗ LOAD_PLUGINS=1 bundle exec rspec plugins/discourse-docs/spec

Randomized with seed 57815
...................................F

Failures:

  1) Discourse Docs | Index topic excerpts when the theme modifier serialize_topic_excerpts is true shows the excerpts
     Failure/Error: expect(page).to have_css(".topic-excerpt", text: topic_1.excerpt)
       expected to find css ".topic-excerpt" but there were no matches

     [Screenshot Image]: /xxxx/discourse/discourse/tmp/capybara/failures_r_spec_example_groups_discourse_docs_index_topic_excerpts_when_the_theme_modifier_serialize_topic_excerpts_is_true_shows_the_excerpts_460.png

     ~~~~~~~ JS LOGS ~~~~~~~
     ~~~~~ END JS LOGS ~~~~~

     # ./plugins/discourse-docs/spec/system/docs_index_spec.rb:52:in `block (4 levels) in <main>'
     # ./spec/rails_helper.rb:469:in `block (2 levels) in <top (required)>'

Finished in 13.16 seconds (files took 2.79 seconds to load)
36 examples, 1 failure

Failed examples:

rspec ./plugins/discourse-docs/spec/system/docs_index_spec.rb:50 # Discourse Docs | Index topic excerpts when the theme modifier serialize_topic_excerpts is true shows the excerpts

Randomized with seed 57815

Did you manage to resolve this @Hyan?

3 posts were split to a new topic: How can I get a table of contents for my docs?

Hey Sam, wouldn’t it make sense from SEO perspective the rel=canonical of topics to point to the original topic? E.g. Dark/Light Mode Toggle - theme-component - Docs - Discourse Meta → Dark/Light Mode Toggle - theme-component - Discourse Meta? I wonder if the two versions of the page don’t cannibalize each other in google’s algorithms.

1 Like

Yes, absolutely we should do something there

1 Like

Sorry @JammyDodger I haven’t got a chance to run the Spec these days. I don’t focus on the work related to Discourse Docs but other stuff these days. But will let you know when I get any chance.

2 Likes

Is there a way to change the icon next to the Docs in the Hamburger Menu from the link/chain to something else?

This plugin is great for having all our document categories all in one place - removing the need for them to also be listed in the Categories list (thanks Discourse Category Hider). However we have noticed an issue:

Within the Docs Plugin/screen you cannot edit existing documents or create new ones - meaning you have to go to the original category, to find the topic/document to edit it
meaning you have to have the document accessible in more than one place.

Is there a way to enable topic/document editing (if the user is in the right User Group) within the Docs plugin?

Does it work to use the “view the discussion on this topic” link at the bottom to navigate to that topic and edit it?

1 Like

Hi, I have an issue that’s real annoying and I do not know why it’s happening.

When i create a doc it goes to the document area and works as its suppose to, however if the document is edited in anyway the docs listing topic document layout switches back to the default discourse topic layout upon click and not show the actual document layout.

I’ve noticed after a few minutes it reverts back to the topic document layout and looks as its supposed to, is there anything that could be causing this?

Note i also use the theme component “Topic Thumbnails” and set to docs thumbnail mode “list”

Found the issue, apparently if I use Topic List Excerpts or Topic lists Thumbnails theme component the clickable href is for the discourse topic page and not the KB docs?topic=xxx so I’m being redirected to discourse topics.

Is there a way to maintain the url path on the docs to docs @sam or should reach out to @david ?

Hi,

Our users recently noticed a minor stylish issue: when the browser has less viewport width, the content of each docs post will overflow, such as in the following screenshot:

I wonder if it would be better to automatically collapse the sidebar, if the viewport is less than ideal; however, even if I collapsed the sidebar, the content would still overflow.

Thanks for the wonderful addon. One question though: is there an option to remove the link from the context hamburger menu? I added it manually in the always-visible section (as we want to use this functionality to showcase longform user-created content like articles etc) and now ended up with it showing up twice:

Both options with lighter background lead to /docs
image

I think you can hide it with some CSS here:

.sidebar-section-link-wrapper[data-list-item-name="docs"] {
    display: none;
}
1 Like

Worked perfectly! Thank you very much!

any chance we can have an option to integrate the comments on a docs page instead of linking to the post and then being able to comment?

I revisited the same link on a device with the same viewport width. While there was still overflow before collapsing the sidebar, I found that after collapsing it, there is no overflow, and the display is normal and aesthetically pleasing.