Skip to content
Discussion options

You must be logged in to vote

Ah, gotcha.

You could override Craft’s default behavior using the EVENT_BEFORE_DEFINE_URL event from a custom module:

use craft\base\Element;
use craft\base\Event;
use craft\elements\Entry;
use craft\events\DefineUrlEvent;

Event::on(Entry::class, Element::EVENT_BEFORE_DEFINE_URL, function(DefineUrlEvent $event) {
    /** @var Entry $entry */
    $entry = $event->sender;

    if (str_starts_with($entry->uri, '#')) {
        $event->url = $entry->uri;
    }
});

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@chrisrowe
Comment options

@brandonkelly
Comment options

Answer selected by chrisrowe
@chrisrowe
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants