WTH, dashboard url needs to contain a hyphen

Why dashboard url needs to contain a hyphen?
image

3 Likes

Most of mine are single words. I only need a hyphen when I have more than one word in the URL (e.g living-room). The hyphen replaces any spaces.

Is there a space at the start or end of your URL? If one has been entered by accident then the dialogue is asking you to replace this with a hyphen.

just check for yourself by adding new dashboard. I’m on 2023.7.3
my old dashboards also are one word but by default url was adding lovelace-word so it had a hyphen. But WTH?

I have same problem, my url is regular IP address without hypen not one word
For example for Node-red i have URL: http://172.17.0.2:8082 (yes Docker)
With this issue i can’t add this webpage

Still have the same issue in HA 2024.8.3 :

Url path needs to contain a hyphen (-). Got {'show_in_sidebar': True, 'icon': 'mdi:account', 'title': 'Test', 'require_admin': True, 'mode': 'storage', 'url_path': 'https://www.google.fr'}

Just had to figure this out myself. The “URL Path” is not an entire URL; it is just the path suffix that is used to access the new dashboard in the HA interface. You set the actual URL of the web page you’re using as a dashboard in the first pop-up that appears when adding a web dashboard. In your case this is where you would put https://www.google.fr/. A suitable “URL Path” might be something like “google-search”, and you can access your dashboard directly with (e.g.) http://homeassistant/google-search/, and see the google page embedded in HA.

The hyphen is (likely) required to ensure that the new path will never conflict with “reserved” paths used by HA itself, because they will never have hyphens. This is a strategy used in other platforms, such as Wordpress, as well.

1 Like

Yea if you don’t jump the gun and instead start typing in the “Title” box first, you’ll see that the URL box auto populates.

Very confusing, would have never figured this out, hadn’t I found this topic!

This also happens when creating new dashboards in the YAML.

The following looks like an obvious dashboard declaration, but will in fact fail with the aforementioned “url path needs to contain a hyphen” error message, even though you might not be aware you’re even setting a URL path!

lights:   # <== THIS IS INVALID!
   mode: yaml
   title: All lights
   icon: mdi:ceiling-light
   show_in_sidebar: true
   filename: dashboards/lights/lights.yaml

And here’s the fix:

lights-board:   # :thumbsup:
   mode: yaml
   title: All lights
   icon: mdi:ceiling-light
   show_in_sidebar: true
   filename: dashboards/lights/lights.yaml