diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml
index 8027ab7b8a..1ad475d7ce 100644
--- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml
+++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml
@@ -122,13 +122,13 @@
@(L["ShareOn"].Value + " :")
-
-
+
-
+
diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/index.js b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/index.js
index 33baf544f1..24bd4e95ba 100644
--- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/index.js
+++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/index.js
@@ -77,42 +77,36 @@
});
};
+ var initSocialShareLinks = function () {
+ var pageHeader = $(".docs-body").find("h1, h2").first().text();
+
+ var projectName = $('#ProjectName')[0].innerText;
+
+ $('#TwitterShareLink').attr('href',
+ 'https://twitter.com/intent/tweet?text=' + encodeURI(pageHeader + " | " + projectName + " | " + window.location.href)
+ );
+
+ $('#LinkedinShareLink').attr('href',
+ 'https://www.linkedin.com/shareArticle?'
+ + 'url=' + encodeURI(window.location.href) + '&'
+ + 'mini=true&'
+ + "summary=" + encodeURI(projectName) + '&'
+ + "title=" + encodeURI(pageHeader) + '&'
+ + "source=" + encodeURI($('#GoToMainWebSite').attr('href'))
+ );
+
+ $('#EmailShareLink').attr('href',
+ 'mailto:?'
+ + 'body=' + encodeURI('I want you to look at ' + window.location.href) + '&'
+ + "subject=" + encodeURI(pageHeader + ' | ' + projectName) + '&'
+ );
+ };
+
initNavigationFilter("sidebar-scroll");
initAnchorTags(".docs-page .docs-body");
- var getTitle = function() {
- var h1Tags = $(document).find('h1');
- if (h1Tags.length < 1) {
- return "";
- }
- return h1Tags[0].innerText;
- }
-
- $('#TwitterShareLink').attr(
- 'href',
- 'https://twitter.com/intent/tweet?text='
- + encodeURI(getTitle() +
- " | " + $('#ProjectName')[0].innerText +
- " | " + window.location.href)
- );
-
- $('#LinkedinShareLink').attr(
- 'href',
- 'https://www.linkedin.com/shareArticle?'
- + 'url=' + encodeURI(window.location.href) + '&'
- + 'mini=true&'
- + "summary=" + encodeURI($('#ProjectName')[0].innerText) + '&'
- + "title=" + encodeURI(getTitle()) + '&'
- + "source=" + encodeURI($('#GoToMainWebSite').attr('href'))
- );
-
- $('#EmailShareLink').attr(
- 'href',
- 'mailto:?'
- + 'body=' + encodeURI('I want you to look at ' + window.location.href) + '&'
- + "subject=" + encodeURI(getTitle() + ' | ' + $('#ProjectName')[0].innerText) + '&'
- );
+ initSocialShareLinks();
});