You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2019/02/04 05:28:08 UTC

[sling-org-apache-sling-app-cms] branch master updated: Updating the document title based on the currently active breacrumb item

This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git


The following commit(s) were added to refs/heads/master by this push:
     new 08b4e8e  Updating the document title based on the currently active breacrumb item
08b4e8e is described below

commit 08b4e8ea6883ee902158a085367aaefcc9a23ef7
Author: Dan Klco <dk...@apache.org>
AuthorDate: Mon Feb 4 00:27:59 2019 -0500

    Updating the document title based on the currently active breacrumb item
---
 ui/src/main/frontend/src/js/cms.js                                | 8 +++++++-
 .../jcr_root/libs/sling-cms/components/pages/base/head.jsp        | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ui/src/main/frontend/src/js/cms.js b/ui/src/main/frontend/src/js/cms.js
index 9fa0566..136a2f2 100644
--- a/ui/src/main/frontend/src/js/cms.js
+++ b/ui/src/main/frontend/src/js/cms.js
@@ -152,7 +152,13 @@ window.onbeforeunload = function() {
         return "Are you sure you want to leave this page?";
     }
 }
-    
+
+if(document.querySelector('.breadcrumb .is-active') != null){
+    var itemTitle = document.querySelector('.breadcrumb .is-active').textContent.trim();
+    if(itemTitle.length > 0){
+        document.title = itemTitle + ' :: ' + document.title;
+    }
+}
 
 rava.bind('.sling-cms-include-config', {
     callbacks : {
diff --git a/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/head.jsp b/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/head.jsp
index d9d2e50..97cf252 100644
--- a/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/head.jsp
+++ b/ui/src/main/resources/jcr_root/libs/sling-cms/components/pages/base/head.jsp
@@ -21,7 +21,7 @@
 	<meta charset="utf-8">
 	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
 	<meta name="viewport" content="width=device-width, initial-scale=1" />
-	<title>Apache Sling :: ${properties['jcr:title']}</title>
+	<title>${properties['jcr:title']} :: Apache Sling CMS</title>
 	<link href="/static/clientlibs/sling-cms/css/styles.min.css" rel="stylesheet" />
 	<link rel="apple-touch-icon" sizes="180x180" href="/static/clientlibs/sling-cms/img/apple-touch-icon.png">
 	<link rel="icon" type="image/png" sizes="32x32" href="/static/clientlibs/sling-cms/img/favicon-32x32.png">