@salesforcedevs/docs-components 1.3.209-tag-alpha → 1.3.209-tag3-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.3.209-tag-alpha",
3
+ "version": "1.3.209-tag3-alpha",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -1320,14 +1320,49 @@ export default class AmfReference extends LightningElement {
1320
1320
  metaNavTitle.setAttribute("content", navTitle);
1321
1321
  }
1322
1322
 
1323
+ /**
1324
+ * Right now, the title tag only changes when you pick a Ref spec,
1325
+ * not every time you choose a subsection of the Ref spec.
1326
+ * This update aims to refresh the title tag with each selection.
1327
+ * If a Ref spec is chosen, we add the value of the <selected topic> to the title.
1328
+ * If a subsection is selected, we update the first part of the current
1329
+ * title with the new <selected topic>.
1330
+ * Example: Following is a sample project structure.
1331
+ * - Project Name
1332
+ * - Ref Spec1
1333
+ * - Summary
1334
+ * - Endpoints
1335
+ * - E1
1336
+ * - E2
1337
+ * - Ref Spec2
1338
+ * - Summary
1339
+ * - Endpoints
1340
+ * - E1 (Selected)
1341
+ * - E2
1342
+ * Previous Title: Ref Spec2 | Project Name | Salesforce Developer
1343
+ * New Title: E1 | Ref Spec2 | Project Name | Salesforce Developer
1344
+ *
1345
+ */
1323
1346
  // eslint-disable-next-line @lwc/lwc/no-document-query
1324
1347
  const coveoTitleMetaTag = document.querySelector(
1325
1348
  'meta[name="coveo-search-title"]'
1326
1349
  );
1327
- if (coveoTitleMetaTag && titleTag && navTitle) {
1328
- const titleTagValue = titleTag.textContent;
1329
- const coveoSerachTitle = navTitle + TITLE_SEPARATOR + titleTagValue;
1330
- coveoTitleMetaTag.setAttribute("content", coveoSerachTitle);
1350
+ if (titleTag) {
1351
+ let titleTagValue = titleTag.textContent;
1352
+ const titleTagSectionValues: string[] =
1353
+ titleTagValue?.split(TITLE_SEPARATOR);
1354
+ if (titleTagSectionValues) {
1355
+ if (titleTagSectionValues.length <= 3) {
1356
+ titleTagValue = navTitle + TITLE_SEPARATOR + titleTagValue;
1357
+ } else {
1358
+ titleTagSectionValues[0] = navTitle;
1359
+ titleTagValue = titleTagSectionValues.join(TITLE_SEPARATOR);
1360
+ }
1361
+ }
1362
+ titleTag.textContent = titleTagValue;
1363
+ if (coveoTitleMetaTag && titleTagValue) {
1364
+ coveoTitleMetaTag.setAttribute("content", titleTagValue);
1365
+ }
1331
1366
  }
1332
1367
  }
1333
1368