示例#1
0
        private static string RenderMetaTags(Entity page)
        {
            var metaTags = new MetaTagCollection();

            #region Description
            var metaDescription = page["metaDescription"];
            if (string.IsNullOrEmpty(metaDescription))
                metaDescription = page["intro"];
            if (string.IsNullOrEmpty(metaDescription))
                metaDescription = page.GetValue<Html>("body").GetExtract(150, true).ToString();
            if (!string.IsNullOrEmpty(metaDescription))
                metaTags.AddName("description", metaDescription);
            #endregion

            #region Keywords
            var keyWords = page["metaKeywords"];
            if (!string.IsNullOrEmpty(keyWords))
                metaTags.AddName("keywords", keyWords);
            #endregion

            #region Author
            var author = page["author"];
            if (string.IsNullOrEmpty(author))
            {
                var document = new Document(page.Id.IntValue);
                var user = new global::umbraco.BusinessLogic.User(document.UserId);
                author = user.Name;
            }
            if (!string.IsNullOrEmpty(author))
                metaTags.AddName("author", author);

            #endregion

            #region Robots

            var noIndex = page.GetValue<bool>("noIndex");
            var noFollow = page.GetValue<bool>("noFollow");

            if (noIndex || noFollow)
                metaTags.AddName("ROBOTS", (noIndex? "NOINDEX" : "INDEX") + ", " + (noFollow? "NOFOLLOW" : "FOLLOW"));

            #endregion

            return metaTags.ToString();
        }
示例#2
0
        /// <summary>
        /// Handles the Click event of the CloseButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.ImageClickEventArgs"/> instance containing the event data.</param>
        protected void CloseButton_Click(object sender, EventArgs e)
        {
            // disable Live Editing
            m_Manager.LiveEditingContext.Enabled = false;

            //ensures that users who are redirected to canvas also gets logged out on exit
            int userid = BasePages.UmbracoEnsuredPage.GetUserId(BasePages.UmbracoEnsuredPage.umbracoUserContextID);

            if (userid > 0)
            {
                BusinessLogic.User u = new global::umbraco.BusinessLogic.User(userid);
                if (u.DefaultToLiveEditing)
                {
                    new BasePages.BasePage().ClearLogin();
                }
            }

            RefreshPage();
        }
        /// <summary>
        /// Handles the Click event of the CloseButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.ImageClickEventArgs"/> instance containing the event data.</param>
        protected void CloseButton_Click(object sender, EventArgs e)
        {
            // disable Live Editing
            m_Manager.LiveEditingContext.Enabled = false;

            //ensures that users who are redirected to canvas also gets logged out on exit
            int userid = BasePages.UmbracoEnsuredPage.GetUserId(BasePages.UmbracoEnsuredPage.umbracoUserContextID);
            if (userid > 0) {
                BusinessLogic.User u = new global::umbraco.BusinessLogic.User(userid);
                if (u.DefaultToLiveEditing)
                    new BasePages.BasePage().ClearLogin();
            }

            RefreshPage();
        }