V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
JCZ2MkKb5S8ZX9pq
V2EX  ›  问与答

docsify 问题求解

  •  
  •   JCZ2MkKb5S8ZX9pq · Oct 28, 2020 · 600 views
    This topic created in 2011 days ago, the information mentioned may be changed or developed.

    背景

    • 我拿 docsify 作为 notebook 在用。里面大部分的内容不公开,个别篇会共享,比如给客户看的说明之类的。

    • 我现在的做法是 localstorage 里写一个 key,如果我登录过,docsify 就把{key}.md 作为 sidebar 文件。这样我就能看到我的所有笔记了。但是外人访问的话,因为这个 key 是空的(也很难猜中),这样我会设 sidebar=false,就只能看到文章大纲。

    if (localStorage.access) {
        sidebar_file = '_sidebar_' + localStorage.access + '.md'
    } else {
        sidebar_file = false // 不让未认证用户读取文件列表
    }
    

    问题点

    • 第一个问题是,docsify 的 autotitle 好像是从 sidebar 取的。我登陆的话网页标题是跟随文章,是显示正确的。但如果别人访问,因为 sidebar:false,所以网页标题就是错误的。

    • 第二个问题是,search 插件好像是作用于所有笔记的。所以即便分享给别人,他虽然看不到左侧文章目录,也能通过 search 常用字,跳转到部分文章。


    请问有没有跟我差不多情况的,给支支招。

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2702 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 50ms · UTC 14:31 · PVG 22:31 · LAX 07:31 · JFK 10:31
    ♥ Do have faith in what you're doing.