verbb / hyper

A Craft CMS plugin for managing links, focusing on user experience.
Other
21 stars 9 forks source link

Provide `item.uri` for Element links #171

Open proimage opened 2 weeks ago

proimage commented 2 weeks ago

What are you trying to do?

Sometimes, I need to get the URI of an entry, i.e. the URL minus the siteUrl variable: URL: https://www.example.com/path/to/my-entry URI: /path/to/my-entry

This is useful when sharing a local DDEV site via ddev share; the site gets served at something like a https://[mini-UID].ngrok-free.app domain. When URLs on the site have https://my-site.ddev.site prepended to them, then no links will work on the NGROK domain.

What's your proposed solution?

Along with the existing variables for links, provide a uri variable, which will not include the site domain, only a root-relative (/something) path.

Additional context

No response

engram-design commented 2 weeks ago

We can't use uri because that's being used by the Element class that Links inherit from, but linkUri is an option.

Added for the next release. To get this early, run composer require verbb/hyper:"dev-craft-4 as 1.1.32" or composer require verbb/hyper:"dev-craft-5 as 2.0.2".