Git Product home page Git Product logo

Comments (3)

bobbingwide avatar bobbingwide commented on September 21, 2024

The solution delivered in Feb 2016 only supports links where the fragment is just part of the link
e.g. [bw_link example.com/page#fragment] or [bw_link example.com/page/#fragment]
and not where it's intended to be a link to somewhere else on the page
e.g. [bw_link #fragment].

The current implementation on some sites appears a bit flaky, with scrolling to the selected ID only working on a tablet. This observation needs verifying.

The solution should support at least some of the techniques documented in https://en.m.wikipedia.org/wiki/Fragment_identifier

from oik.

bobbingwide avatar bobbingwide commented on September 21, 2024

The code's been updated to provide better support when linking to a specified domain and when using #fragment on its own.
Tests have been implemented for both without fragments - see below - and with.

bw_link 0th parameter Expected to produce Implemented?
empty link Yes
/ Link to $domain Yes
/somewhere Link to $domain/somwehere Yes
/somewhere/child Link to $domain/somewhere/child Yes
example.com Link to example.com Yes
example.com/path Link to example.com/path Yes
http://example.com Link as given Yes
https://example.com Link as given Yes
18356 Link to post 18356 Yes
post_type Link to the Post type archive ?
archive Link to any other archive? ?
s://p Multisite link s is site ID and p is post ID No

Notes:

  • When we link to somewhere in the current domain we don't check that the permalink exists
  • We no longer support links to child pages
  • $domain may not include the scheme... as it's stripped in bw_get_domain

from oik.

bobbingwide avatar bobbingwide commented on September 21, 2024

It would also be nice to be able to automatically generate nice link text and title when using #fragment.
to support something like this.

[bw_link "#This fragment"]
[bw_link "#That fragment"]
...
[div id="This fragment"]
<h3>This fragment</h3>
[ediv]
[div id="That fragment"]
<h3>That fragment</h3>
[ediv]

from oik.

Related Issues (20)

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.