Quicklinks - The MDN project 编辑

MDN supports adding quicklinks to pages; these are boxes containing a potentially hierarchical list of links to other pages on MDN or to pages off-site. This article describes how to create quicklinks boxes.

A page may have no more than one quicklinks box, which is presented in the left-hand sidebar. This sidebar may, optionally, be hidden by the user by clicking the "Hide this sidebar" link at the top of the sidebar.

The quicklinks for a page are provided by creating a <section> block with the ID "Quick_Links". Then you place the contents that go into the quicklinks box within the section. These should be formatted as an <ol> ordered list (optionally nested). You can do this by using the numbered list button in the editor toolbar. For example, this page has a quicklinks box that connects you to several useful pages. Its HTML looks like this:

<section id="Quick_Links">
  <ol>
    <li><a href="http://docs.ckeditor.com/">CKEditor documentation site</a></li>
    <li><a href="http://mxr.mozilla.org/">MXR: Mozilla source cross-reference</a></li>
    <li class="toggle">
      <details><summary>Style guides</summary>
      <ol>
        <li><a href="http://www.economist.com/research/StyleGuide/">The Economist style guide</a></li>
        <li><a href="http://www.amazon.com/gp/product/0226104036/">The Chicago manual of style</a></li>
        <li><a href="http://www.answers.com/library/Dictionary">Answers.com dictionary</a></li>
        <li><a href="http://www.wsu.edu/~brians/errors/">Common Errors in English</a></li>
      </ol>
      </details>
    </li>
  </ol>
</section>

The important things to note:

  • The list should be an ordered list.
  • You may have nested lists by using a <details> containing another ordered list inside the same <li> block.

Main article: How to use navigation sidebars

It's worth noting that you can (and often should) use macros to generate quicklinks. Any time you need to use the same set of quicklinks on more than one page, you should turn them into a macro. This page, for example, uses the MDNSidebar macro to create its quicklinks box; so does every other page in the MDN editor guide.

Your macro can be as simple or as complex as necessary; it needs to output HTML similar to what's shown in Quicklinks syntax above.

Here's a list of our standard macros for generating quicklinks.

CSSRef
Builds the standard quicklinks for CSS Reference pages.
HTMLRef
Builds the standard quicklinks for HTML Reference pages.
MakeSimpleQuicklinks
Given a list of pages on MDN, this macro constructs a quicklinks box using the pages' titles as the link text and their summaries as tooltips. This doesn't create hierarchical lists.
QuickLinksWithSubpages
Creates a set of quicklinks using the current page's (or the specified page's) children as the destinations. This creates hierarchical lists up to two levels deep. The pages' titles are used as the link text and their summaries as tooltips.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:102 次

字数:5126

最后编辑:8年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文