Add a footer notice for Docsify.js
npm install @markbattistella/docsify-sidebarfooterThis plugin enhances your website's sidebar or page by creating a footer area where you can display important information. It automatically updates the copyright year or range, allows you to include your name or company with a URL, and provides links to a privacy policy, terms of service, and cookies policy pages. By utilising this plugin, you can easily showcase relevant legal information, personalise your website, and promote transparency and compliance.
!> Note: There are breaking changes in the configuration from v4.x to v5.x. Please take the time to read all the documentation before upgrading
Assuming you have a working docsify framework set up, it is easy to use the plugin.
1. Add one of the following script tags to your index.html via either CDN or downloading it and using it locally:
``html
`
1. In docsify setup configure the plugin:
`js`
#### Default
If you set the policy, terms, or cookies options to true the URL links for those pages will look for the markdown files directly next to the index.html file:
`js`
// ... other config
policy: true,
terms: true,
cookies: true,
// ... other config
`md`
- index.html --> https://your-awesome-site.com/#/
- _policy.md --> https://your-awesome-site.com/#/_policy
- _terms.md --> https://your-awesome-site.com/#/_terms
- _cookies.md --> https://your-awesome-site.com/#/_cookies
#### Sub-folder
However, if you enter a string it will append that to the base URL of your website:
`js`
// ... other config
policy: 'site/policy',
terms: 'site/terms',
cookies: 'site/cookies',
// ... other config
`md`
- index.html --> https://your-awesome-site.com/#/
- site/
\__ policy.md --> https://your-awesome-site.com/#/site/policy
\__ terms.md --> https://your-awesome-site.com/#/site/terms
\__ cookies.md --> https://your-awesome-site.com/#/site/cookies
#### External links
If you host your policy, terms, or cookies messages on an external website (or need to link to a parent company policy) you can add them in as the full URL:
`js`
// ... other config
policy: "https://my-other-website.com/policy",
terms: "https://my-other-website.com/terms",
cookies: "https://my-other-website.com/cookies",
// ... other config
These will open those pages in a new tab directly.
There are some options available for the docsify-sidebarfooter:
| Setting | Type | Options |
|---------------|----------------|------------------------------------|
| name | String | your name or company |url
| | String | url you want the name to link to |copyYear
| | String | first year of copyright |policy
| | Bool or String | - false hides it from the sitetrue
- defaults to _policy.mdterms
- a custom string will direct to that |
| | Bool or String | - false hides it from the sitetrue
- defaults to _terms.mdcookies
- a custom string will direct to that |
| | Bool or String | - false hides it from the sitetrue
- defaults to _cookies.mdcustomStyle
- a custom string will direct to that |
| | Bool or String | - false uses in-built css (sidebar styled)true
- applies no styles, you can create your ownsidebar
- uses the in-built css designed for the sidebarbody
- uses the in-built css designed for the body |
At the bottom of your _sidebar.md file add the following code:
`html`
Under the
in your index.html file, add the following code:`html
`Styling
The links container is sectioned into different classes for you to customise as much (or little) as you wish.
`html
`Contributing
1. Clone the repo:
git clone https://github.com/markbattistella/docsify-sidebarFooter.git
2. Create your feature branch:
git checkout -b my-feature
3. Commit your changes:
git commit -am 'Add some feature'
4. Push to the branch:
git push origin my-new-feature
5. Submit the pull` request