GithubHelp home page GithubHelp logo

markbattistella / docsify-sidebar-footer Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 4.0 213 KB

Add some info at the bottom of your sidebar. Link to your personal website, a Privacy Policy, Terms of Service

Home Page: https://footer.docsify.markbattistella.com

License: MIT License

footer docsify docsify-plugin plugin tos privacy cookie

docsify-sidebar-footer's Introduction

docsify.js sidebar footer

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.

Installation

!> 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

Update index.html file

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:

    <!-- unpkg.com -->
    <script src="https://unpkg.com/@markbattistella/docsify-sidebarfooter@latest"></script>
    
    <!-- jsDelivr -->
    <script src="https://cdn.jsdelivr.net/npm/@markbattistella/docsify-sidebarfooter@latest"></script>
    
    <!-- locally -->
    <script src="docsify-sidebar.min.js"></script>
  2. In docsify setup configure the plugin:

    <script>
    window.$docsify = {
      autoFooter: {
    
        // the name you wish to display as the copyright holder
        name:        String,
    
        // the URL (personal or company) which clicking the `name` goes to
        url:         String,
    
        // the start year of copyright
        copyYear:    String,
    
        // show the privacy policy link
        policy:      Bool | String,
    
        // show the terms of service link
        terms:       Bool | String,
    
        // show the cookies policy link
        cookies:     Bool | String,
    
        // use your own css styles or the built in ones
        customStyle: Bool | String
      }
    };
    </script>

Additional files

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:

// ... other config
policy: true,
terms: true,
cookies: true,
// ... other config
- 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:

// ... other config
policy: 'site/policy',
terms: 'site/terms',
cookies: 'site/cookies',
// ... other config
- 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:

// ... 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.

Configuration

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 site
- true defaults to _policy.md
- a custom string will direct to that
terms Bool or String - false hides it from the site
- true defaults to _terms.md
- a custom string will direct to that
cookies Bool or String - false hides it from the site
- true defaults to _cookies.md
- a custom string will direct to that
customStyle Bool or String - false uses in-built css (sidebar styled)
- true applies no styles, you can create your own
- sidebar uses the in-built css designed for the sidebar
- body uses the in-built css designed for the body

Usage

Sidebar

At the bottom of your _sidebar.md file add the following code:

<footer id="mb-footer"></footer>

Body

Under the <div id="app"></div> in your index.html file, add the following code:

<footer id="mb-footer"></footer>

Styling

The links container is sectioned into different classes for you to customise as much (or little) as you wish.

<footer id="mb-footer">
  <div class="footer-container">
    <div class="footer-text">
      <span class="footer-text-copyright">
        Copyright © YYYY-YYYY
      </span>
      <span class="footer-text-author">
        <a target="_blank" href="">Your website name</a>
      </span>
    </div>
    <div class="footer-link">
      <span class="footer-links-policy">
        <a href="">Policy</a>
      </span>
      <span class="footer-links-terms">
        <a href="">Terms</a>
      </span>
      <span class="footer-links-cookies">
        <a href="">Cookies</a>
      </span>
    </div>
  </div>
</footer>

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

docsify-sidebar-footer's People

Contributors

markbattistella avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

docsify-sidebar-footer's Issues

External Urls

I have a seperate website for my privacy policy and terms of service. Is there a way I can set custom links instead of the path to a markdown file?

URLs are relative to base, not exisiting URL

Description

At present if the address is: https://markbattistella.github.io/docsify-sidebarFooter/#/ clicking on the sidebar links of policy and terms return to 404 error pages.

What happens

The link they direct to are:

https://markbattistella.github.io/#/policy and https://markbattistella.github.io/#/terms

What should happen

The links should retain the full existing url:

https://markbattistella.github.io/docsify-sidebarFooter/#/policy and https://markbattistella.github.io/docsify-sidebarFooter/#/terms

Hope to be able to show in the right place

I use the following configuration

autoFooter: {
        name:       'Eryajf',          // company display name (required)
        copyYear:   2021,             // start copyright year (required)
        url:        '',          // company url (optional)
        policy:     true,   // show Privacy Policy (optional)
        terms:      true,   // show Terms of Service (optional)
        cookies:    false,   // show Cookies Policy (optional)
        onBody:     true             // if true it is on the main doc
      }

The following effects are obtained:

image

How should I show it in the text。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.