bobbingwide / oik-shortcodes

Shortcode, block and API server
https://www.oik-plugins.com/oik-plugins/oik-shortcode-server/
GNU General Public License v2.0
1 stars 0 forks source link

Improve performance with pragmatic links #18

Open bobbingwide opened 8 years ago

bobbingwide commented 8 years ago

Some shortcodes, such as [hook], [file] and [api] can take time to find the permalink. There can be many links on a page. But the user's only going to click on one of them. So, unless there is some useful information in the link ( such as the API title) there's little point attempting to resolve the link immediately. 404 handling can be used to pragmatically deal with links that weren't found, or, if it's enabled, we can attempt to use AJAX when the user shows some intent to click on the link.

bobbingwide commented 8 years ago

For WP-a2z, which is WordPress MultiSite, we can use pragmatic links when creating the parsed source. When the link is not found we'll use logic in the 404 page to display the content from the base site, assuming that exists.

We need to be able to store a noderef field as a string rather than a post ID and cater for this when handling the mapping to an actual post.

bobbingwide commented 8 years ago

When processing the [file] shortcode for an oik_file post, if the function is not yet mapped to a permalink then create one anyway.

bobbingwide commented 8 years ago

Re: or if it's enabled we can attempt to use AJAX when the user shows some intent to click on the link.

Proposal

When the user is hovering over a link use the REST API to query further information about the target.

Note: hookr.io does this for actions and filter hooks. We could attempt to do it for just about anything.

For the dynamic links in the syntax highlighted source

Field hovered Information to display
api Syntax and long description and various external links
class Short description and parent class and various external links
constant tbc
file link to file
hook Syntax and description and various external links
PHP function Syntax and description
string version in user's selected language link to translation page

Similarly for shortcodes

Field hovered Information to display
shortcode link Syntax
shortcode parameter any further information about the parameter

Note: I'm not sure how to know when to actually initiate the calls.

bobbingwide commented 8 years ago

Note: See #38 where external links to GitHub and/or Trac has already been added for APIs and files.