Files
backstage/.changeset/nice-feet-hope.md
T
Patrik Oldsberg 5fdc8df0e8 cli: make config available in index.html template
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
2021-12-19 15:11:13 +01:00

982 B

@backstage/create-app
@backstage/create-app
patch

The index.html template of the app has been updated to use the new config global provided by the Backstage CLI.

To apply this change to an existing app, make the following changes to packages/app/public/index.html:

-    <title><%= app.title %></title>
+    <title><%= config.getString('app.title') %></title>
-    <% if (app.googleAnalyticsTrackingId && typeof app.googleAnalyticsTrackingId === 'string') { %>
+    <% if (config.has('app.googleAnalyticsTrackingId')) { %>
     <script
       async
-      src="https://www.googletagmanager.com/gtag/js?id=<%= app.googleAnalyticsTrackingId %>"
+      src="https://www.googletagmanager.com/gtag/js?id=<%= config.getString('app.googleAnalyticsTrackingId') %>"
     ></script>
-      gtag('config', '<%= app.googleAnalyticsTrackingId %>');
+      gtag(
+        'config',
+        '<%= config.getString("app.googleAnalyticsTrackingId") %>',
+      );