|
| 1 | +# docsify.js sidebar footer |
| 2 | + |
| 3 | +This 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. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +### Update `index.html` file |
| 8 | + |
| 9 | +!> Some of the configurations items have changed in `v5.x` please take note |
| 10 | + |
| 11 | +Assuming you have a working [docsify](https://docsify.js.org/) framework set up, it is easy to use the plugin. |
| 12 | + |
| 13 | +1. Add one of the following script tags to your `index.html` via either CDN or downloading it and using it locally: |
| 14 | + |
| 15 | + ```html |
| 16 | + <!-- unpkg.com --> |
| 17 | + <script src="https://unpkg.com/@markbattistella/docsify-sidebarfooter@latest"></script> |
| 18 | + |
| 19 | + <!-- jsDelivr --> |
| 20 | + <script src="https://cdn.jsdelivr.net/npm/@markbattistella/docsify-sidebarfooter@latest"></script> |
| 21 | + |
| 22 | + <!-- locally --> |
| 23 | + <script src="docsify-sidebar.min.js"></script> |
| 24 | + ``` |
| 25 | + |
| 26 | +1. In docsify setup configure the plugin: |
| 27 | + |
| 28 | + ```js |
| 29 | + <script> |
| 30 | + window.$docsify = { |
| 31 | + autoFooter: { |
| 32 | +
|
| 33 | + // the name you wish to display as the copyright holder |
| 34 | + name: String, |
| 35 | +
|
| 36 | + // the URL (personal or company) which clicking the `name` goes to |
| 37 | + url: String, |
| 38 | +
|
| 39 | + // the start year of copyright |
| 40 | + copyYear: String, |
| 41 | +
|
| 42 | + // show the privacy policy link |
| 43 | + policy: Bool | String, |
| 44 | +
|
| 45 | + // show the terms of service link |
| 46 | + terms: Bool | String, |
| 47 | +
|
| 48 | + // show the cookies policy link |
| 49 | + cookies: Bool | String, |
| 50 | +
|
| 51 | + // use your own css styles or the built in ones |
| 52 | + customStyle: Bool | String |
| 53 | + } |
| 54 | + }; |
| 55 | + </script> |
| 56 | + ``` |
| 57 | + |
| 58 | +### Additional files |
| 59 | + |
| 60 | +#### Default |
| 61 | + |
| 62 | +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: |
| 63 | + |
| 64 | +```js |
| 65 | +// ... other config |
| 66 | +policy: true, |
| 67 | +terms: true, |
| 68 | +cookies: true, |
| 69 | +// ... other config |
| 70 | +``` |
| 71 | + |
| 72 | +```md |
| 73 | +- index.html --> https://your-awesome-site.com/#/ |
| 74 | +- _policy.md --> https://your-awesome-site.com/#/_policy |
| 75 | +- _terms.md --> https://your-awesome-site.com/#/_terms |
| 76 | +- _cookies.md --> https://your-awesome-site.com/#/_cookies |
| 77 | +``` |
| 78 | + |
| 79 | +#### Sub-folder |
| 80 | + |
| 81 | +However, if you enter a string it will append that to the base URL of your website: |
| 82 | + |
| 83 | +```js |
| 84 | +// ... other config |
| 85 | +policy: 'site/policy', |
| 86 | +terms: 'site/terms', |
| 87 | +cookies: 'site/cookies', |
| 88 | +// ... other config |
| 89 | +``` |
| 90 | + |
| 91 | +```md |
| 92 | +- index.html --> https://your-awesome-site.com/#/ |
| 93 | +- site/ |
| 94 | + \__ policy.md --> https://your-awesome-site.com/#/site/policy |
| 95 | + \__ terms.md --> https://your-awesome-site.com/#/site/terms |
| 96 | + \__ cookies.md --> https://your-awesome-site.com/#/site/cookies |
| 97 | +``` |
| 98 | + |
| 99 | +#### External links |
| 100 | + |
| 101 | +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: |
| 102 | + |
| 103 | +```js |
| 104 | +// ... other config |
| 105 | +policy: "https://my-other-website.com/policy", |
| 106 | +terms: "https://my-other-website.com/terms", |
| 107 | +cookies: "https://my-other-website.com/cookies", |
| 108 | +// ... other config |
| 109 | +``` |
| 110 | + |
| 111 | +These will open those pages in a new tab directly. |
| 112 | + |
| 113 | +## Configuration |
| 114 | + |
| 115 | +There are some options available for the `docsify-sidebarfooter`: |
| 116 | + |
| 117 | +| Setting | Type | Options | |
| 118 | +|---------------|----------------|------------------------------------| |
| 119 | +| `name` | String | your name or company | |
| 120 | +| `url` | String | url you want the `name` to link to | |
| 121 | +| `copyYear` | String | first year of copyright | |
| 122 | +| `policy` | Bool or String | - `false` hides it from the site<br/>- `true` defaults to `_policy.md`<br/>- a custom string will direct to that | |
| 123 | +| `terms` | Bool or String | - `false` hides it from the site<br/>- `true` defaults to `_terms.md`<br/>- a custom string will direct to that | |
| 124 | +| `cookies` | Bool or String | - `false` hides it from the site<br/>- `true` defaults to `_cookies.md`<br/>- a custom string will direct to that | |
| 125 | +| `customStyle` | Bool or String | - `false` uses in-built css (sidebar styled)<br/>- `true` applies no styles, you can create your own<br/>- `sidebar` uses the in-built css designed for the sidebar<br/>- `body` uses the in-built css designed for the body | |
| 126 | + |
| 127 | +## Usage |
| 128 | + |
| 129 | +### Sidebar |
| 130 | + |
| 131 | +At the bottom of your `_sidebar.md` file add the following code: |
| 132 | + |
| 133 | +```html |
| 134 | +<footer id="mb-footer"></footer> |
| 135 | +``` |
| 136 | + |
| 137 | +### Body |
| 138 | + |
| 139 | +Under the `<div id="app"></div>` in your `index.html` file, add the following code: |
| 140 | + |
| 141 | +```html |
| 142 | +<footer id="mb-footer"></footer> |
| 143 | +``` |
| 144 | + |
| 145 | +## Styling |
| 146 | + |
| 147 | +The links container is sectioned into different classes for you to customise as much (or little) as you wish. |
| 148 | + |
| 149 | +```html |
| 150 | +<footer id="mb-footer"> |
| 151 | + <div class="footer-container"> |
| 152 | + <div class="footer-text"> |
| 153 | + <span class="footer-text-copyright"> |
| 154 | + Copyright © YYYY-YYYY |
| 155 | + </span> |
| 156 | + <span class="footer-text-author"> |
| 157 | + <a target="_blank" href="">Your website name</a> |
| 158 | + </span> |
| 159 | + </div> |
| 160 | + <div class="footer-link"> |
| 161 | + <span class="footer-links-policy"> |
| 162 | + <a href="">Policy</a> |
| 163 | + </span> |
| 164 | + <span class="footer-links-terms"> |
| 165 | + <a href="">Terms</a> |
| 166 | + </span> |
| 167 | + <span class="footer-links-cookies"> |
| 168 | + <a href="">Cookies</a> |
| 169 | + </span> |
| 170 | + </div> |
| 171 | + </div> |
| 172 | +</footer> |
| 173 | +``` |
| 174 | + |
| 175 | +## Contributing |
| 176 | + |
| 177 | +1. Clone the repo:<br>`git clone https://github.com/markbattistella/docsify-sidebarFooter.git` |
| 178 | +2. Create your feature branch:<br>`git checkout -b my-feature` |
| 179 | +3. Commit your changes:<br>`git commit -am 'Add some feature'` |
| 180 | +4. `Push` to the branch:<br>`git push origin my-new-feature` |
| 181 | +5. Submit the `pull` request |
0 commit comments