Fork CMS Documentation Module
A documentation module for Fork CMS, used in the official Fork CMS documentation site (Coming soon!). Parses markdown files from a git repository and displays them as documentation on a Fork CMS website.
You will need to store your documentation in markdown (*.md) files in a git repository (e.g. see forkcms documentation). Once you configured the module settings, the module builds a navigation tree based on the git repository folders and files. When you click a navigation item in the frontend part of your site, the content of the markdown file is fetched and parsed to html and displayed on the page. The documentation uses (almost) no database interaction and is fully dynamic. Everything is cached to speed up everything and save additional github requests.
- Copy the
/src/Backend/Modules/Documentationfolder to your site's
- Copy the
/src/Frontend/Modules/Documentationfolder to your site's
- Browse to your Fork CMS backend.
- Go to
Settings > Modules. Click on the install button next to the Documentation module.
- Have fun!
Configuring the module settings
- Go to the Fork CMS backend and then to
Settings > Modules > Documentation.
- Repository info: You will need the Github organization/username and the name of the repository. You can find these values by just copying the Github documentation repository url (github.com/username/repository).
- oAuth Token: Without authentication, Github offers 60 requests per hour (See Github Rate Limiting). When the documentation is not in the cache, a requests gets sent to Github. It could happen that you reach your rate limit and an error gets thrown. Therefore, you can generate an oAuth token. Go to your Github profile settings > Personal access tokens > Generate new token. Only select checkbox "public_repo" and generate the token. Copy and paste the token onto the Fork CMS Documentation settings page. You now have 5000 requests/hour which should be sufficient because we use caching once the contents of a file are fetched.
Setting up a git webhook to clear cache
Imagine you update your documentation on Github. Then you would want to see those changes appearing on your documentation site.
Because we use caching, the old version of a page would still show up. You could manually clear the cache (clear
src/Frontend/Cache/Documentation), or start using a Github webhook to trigger clearing the cache.
To setup a Github webhook:
- Go to your Github documentation repo settings > Webhooks & services
- Click the Add webhook button
- Use the following settings:
- Payload URL: http://domain.com/documentation-page-name/webhook-cache-clear
- Secret: Choose one yourself
- Event: Just the push event (this will include merges and pushes)
- Every time you merge or push to the documentation repo, a documentation cache clear action will trigger on your website.
- Do you have a search widget to search our documentation?
No, but please try Algolia DocSearch. Algolia offers Search-as-a-Service. Think of Algolia very much like you would Stripe. If Stripe makes payment processing a cinch, then Algolia makes advanced search accessible to everyone.
Algolia is a hosted cloud search solution with easy API access. They offer free (!) documentation search for your documentation projects like
React, Scala, Babel.js, ... Integrating Algolia DocSearch is really easy. You only have to add a
- Do you support other Git services like Bitbucket or Gitlab, or other locations to store your documentation (FTP, ...)? No, not at the moment. But adding Bitbucket or Gitlab support is easy. Add a BitBucketDocumentation class that implements the RepositoryInterface and add a BitBucketAdapter.
Bugs & Feature requests
If you encounter any bugs of have a feature request, please create an issue so we can fix it (or feel free to fix it yourself with a pull-request).