In the Shortcuts app on your Mac, double-click a shortcut.
Add any other actions you want to include in the shortcut.
Click to open Details, then select Services Menu.
A new action appears. To ensure that the shortcut appears only in Safari, deselect all input types except “Safari webpages.”
For more information, see Understanding input types in Shortcuts on Mac.
In Safari, choose your shortcut from Safari > Services.