Wagtail client-side components
    Preparing search index...

    Function getWagtailDirectives

    • Extract the Wagtail directives from the URL fragment.

      This follows the algorithm described in https://wicg.github.io/scroll-to-text-fragment/#extracting-the-fragment-directive for extracting the fragment directive from the URL fragment, with a few differences:

      • We use a :w: delimiter instead of the proposed :~: delimiter.
      • We don't remove our directive from the URL fragment.

      Returns string

      a string of Wagtail directives, if any, in the style of URL search parameters.

      window.location.hash = '#:w:contentpath=abc1.d2e.3f'
      // getWagtailDirectives() === 'contentpath=abc1.d2e.3f'
      window.location.hash = '#an-anchor:w:contentpath=abc1.d2e.3f'
      // getWagtailDirectives() === 'contentpath=abc1.d2e.3f'
      window.location.hash = '#hello:w:contentpath=abc1.d2e.3f&unknown=123&unknown=456'
      // getWagtailDirectives() === 'contentpath=abc1.d2e.3f&unknown=123&unknown=456'