Skip to content

Commit 2955cb4

Browse files
authored
Make use of documentationUrl over hardcoded docs links (#28022)
Make use of documentationUrl over hardcoded docs link
1 parent c679e31 commit 2955cb4

File tree

9 files changed

+27
-12
lines changed

9 files changed

+27
-12
lines changed

src/data/backup.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
import { formatTime } from "../common/datetime/format_time";
1111
import type { LocalizeFunc } from "../common/translations/localize";
1212
import type { HomeAssistant } from "../types";
13+
import { documentationUrl } from "../util/documentation-url";
1314
import { fileDownload } from "../util/file_download";
1415
import { handleFetchPromise } from "../util/hass-call-api";
1516
import type { BackupManagerState, ManagerStateEvent } from "./backup_manager";
@@ -414,7 +415,7 @@ ${hass.auth.data.hassUrl}
414415
${hass.localize("ui.panel.config.backup.emergency_kit_file.encryption_key")}
415416
${encryptionKey}
416417
417-
${hass.localize("ui.panel.config.backup.emergency_kit_file.more_info", { link: "https://www.home-assistant.io/more-info/backup-emergency-kit" })}`);
418+
${hass.localize("ui.panel.config.backup.emergency_kit_file.more_info", { link: documentationUrl(hass, "/more-info/backup-emergency-kit") })}`);
418419

419420
export const geneateEmergencyKitFileName = (
420421
hass: HomeAssistant,

src/layouts/supervisor-error-screen.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { atLeastVersion } from "../common/config/version";
55
import { applyThemesOnElement } from "../common/dom/apply_themes_on_element";
66
import "../components/ha-card";
77
import { haStyle } from "../resources/styles";
8+
import { documentationUrl } from "../util/documentation-url";
89
import type { HomeAssistant } from "../types";
910
import "./hass-subpage";
1011

@@ -57,7 +58,7 @@ class SupervisorErrorScreen extends LitElement {
5758
</li>
5859
<li>
5960
<a
60-
href="https://www.home-assistant.io/help/"
61+
href=${documentationUrl(this.hass, "/help/")}
6162
target="_blank"
6263
rel="noreferrer"
6364
>

src/onboarding/onboarding-welcome-links.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { LitElement, css, html, nothing } from "lit";
44
import { customElement, property } from "lit/decorators";
55
import type { LocalizeFunc } from "../common/translations/localize";
66
import "../components/ha-card";
7+
import { documentationUrl } from "../util/documentation-url";
78
import type { HomeAssistant } from "../types";
89
import { showAppDialog } from "./dialogs/show-app-dialog";
910
import { showCommunityDialog } from "./dialogs/show-community-dialog";
@@ -22,7 +23,10 @@ class OnboardingWelcomeLinks extends LitElement {
2223
return html`<a
2324
target="_blank"
2425
rel="noreferrer noopener"
25-
href="https://www.home-assistant.io/blog/2016/01/19/perfect-home-automation/"
26+
href=${documentationUrl(
27+
this.hass,
28+
"/blog/2016/01/19/perfect-home-automation/"
29+
)}
2630
>
2731
<onboarding-welcome-link
2832
noninteractive

src/panels/config/blueprint/dialog-import-blueprint.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { mdiClose, mdiOpenInNew } from "@mdi/js";
22
import { css, html, LitElement, nothing } from "lit";
33
import { customElement, property, query, state } from "lit/decorators";
44
import { fireEvent } from "../../../common/dom/fire_event";
5+
import { documentationUrl } from "../../../util/documentation-url";
56
import "../../../components/ha-alert";
67
import "../../../components/ha-button";
78
import "../../../components/ha-code-editor";
@@ -140,7 +141,7 @@ class DialogImportBlueprint extends LitElement {
140141
<ha-button
141142
size="small"
142143
appearance="plain"
143-
href="https://www.home-assistant.io/get-blueprints"
144+
href=${documentationUrl(this.hass, "/get-blueprints")}
144145
target="_blank"
145146
rel="noreferrer noopener"
146147
>

src/panels/config/blueprint/ha-blueprint-overview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ class HaBlueprintOverview extends LitElement {
299299
>
300300
<ha-button
301301
appearance="plain"
302-
href="https://www.home-assistant.io/get-blueprints"
302+
href=${documentationUrl(this.hass, "/get-blueprints")}
303303
target="_blank"
304304
rel="noreferrer noopener"
305305
size="small"

src/panels/config/energy/components/ha-energy-validation-result.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { css, html, LitElement, nothing } from "lit";
22
import { customElement, property } from "lit/decorators";
33
import "../../../../components/ha-alert";
44
import type { EnergyValidationIssue } from "../../../../data/energy";
5+
import { documentationUrl } from "../../../../util/documentation-url";
56
import type { HomeAssistant } from "../../../../types";
67

78
@customElement("ha-energy-validation-result")
@@ -29,7 +30,10 @@ class EnergyValidationMessage extends LitElement {
2930
)}
3031
${issue.type === "recorder_untracked"
3132
? html`(<a
32-
href="https://www.home-assistant.io/integrations/recorder#configure-filter"
33+
href=${documentationUrl(
34+
this.hass,
35+
"/integrations/recorder#configure-filter"
36+
)}
3337
target="_blank"
3438
rel="noopener noreferrer"
3539
>${this.hass.localize("ui.panel.config.common.learn_more")}</a

src/panels/config/labs/ha-config-labs.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import type { HomeAssistant } from "../../../types";
1616
import { SubscribeMixin } from "../../../mixins/subscribe-mixin";
1717
import { brandsUrl } from "../../../util/brands-url";
1818
import { showToast } from "../../../util/toast";
19+
import { documentationUrl } from "../../../util/documentation-url";
1920
import { haStyle } from "../../../resources/styles";
2021
import { showLabsPreviewFeatureEnableDialog } from "./show-dialog-labs-preview-feature-enable";
2122
import {
@@ -100,7 +101,7 @@ class HaConfigLabs extends SubscribeMixin(LitElement) {
100101
? html`
101102
<a
102103
slot="toolbar-icon"
103-
href="https://www.home-assistant.io/integrations/labs/"
104+
href=${documentationUrl(this.hass, "/integrations/labs/")}
104105
target="_blank"
105106
rel="noopener noreferrer"
106107
.title=${this.hass.localize("ui.common.help")}
@@ -124,7 +125,7 @@ class HaConfigLabs extends SubscribeMixin(LitElement) {
124125
"ui.panel.config.labs.empty.description"
125126
)}
126127
<a
127-
href="https://www.home-assistant.io/integrations/labs/"
128+
href=${documentationUrl(this.hass, "/integrations/labs/")}
128129
target="_blank"
129130
rel="noopener noreferrer"
130131
>

src/panels/config/tags/dialog-tag-detail.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { CSSResultGroup } from "lit";
22
import { LitElement, css, html, nothing } from "lit";
33
import { customElement, property, state } from "lit/decorators";
44
import { fireEvent } from "../../../common/dom/fire_event";
5+
import { documentationUrl } from "../../../util/documentation-url";
56
import "../../../components/ha-alert";
67
import "../../../components/ha-button";
78
import { createCloseHeading } from "../../../components/ha-dialog";
@@ -14,8 +15,6 @@ import { haStyleDialog } from "../../../resources/styles";
1415
import type { HomeAssistant } from "../../../types";
1516
import type { TagDetailDialogParams } from "./show-dialog-tag-detail";
1617

17-
const TAG_BASE = "https://www.home-assistant.io/tag/";
18-
1918
@customElement("dialog-tag-detail")
2019
class DialogTagDetail
2120
extends LitElement
@@ -122,7 +121,7 @@ class DialogTagDetail
122121
</div>
123122
<div id="qr">
124123
<ha-qr-code
125-
.data=${`${TAG_BASE}${this._params!.entry!.id}`}
124+
.data=${`${documentationUrl(this.hass, "/tag/")}${this._params!.entry!.id}`}
126125
center-image="/static/icons/favicon-192x192.png"
127126
error-correction-level="quartile"
128127
scale="5"

src/panels/profile/ha-advanced-mode-row.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import "../../components/ha-settings-row";
77
import "../../components/ha-switch";
88
import type { CoreFrontendUserData } from "../../data/frontend";
99
import { saveFrontendUserData } from "../../data/frontend";
10+
import { documentationUrl } from "../../util/documentation-url";
1011
import type { HomeAssistant } from "../../types";
1112

1213
@customElement("ha-advanced-mode-row")
@@ -31,7 +32,10 @@ class AdvancedModeRow extends LitElement {
3132
<span slot="description">
3233
${this.hass.localize("ui.panel.profile.advanced_mode.description")}
3334
<a
34-
href="https://www.home-assistant.io/blog/2019/07/17/release-96/#advanced-mode"
35+
href=${documentationUrl(
36+
this.hass,
37+
"/blog/2019/07/17/release-96/#advanced-mode"
38+
)}
3539
target="_blank"
3640
rel="noreferrer"
3741
>${this.hass.localize("ui.panel.profile.advanced_mode.link_promo")}

0 commit comments

Comments
 (0)