This project is read-only.

Little improvement for meta tag description

Topics: ASP.NET 2.0
Sep 5, 2008 at 8:13 AM
Users don't generally use description for all posts (in some cases they don't use at all). May I suggest to change the post.aspx.cs AddMetadescription in this way?

    private void AddMetaDescription()
        string descr = Server.HtmlEncode(Post.Description);
        if (string.IsNullOrEmpty(descr))
            descr = Regex.Replace(Post.Content, @"<(.|\n)*?>", string.Empty).Substring(0, 65) + "...";
        base.AddMetaTag("description", descr);

to always has a meta tag?
Sep 5, 2008 at 10:37 AM
I think this is a really good idea. It would need to be carefully considered as to whether this was baked into the core BE code or added as an extensible component. Either way, there should be the configuration support to enable/disable the feature.
Sep 5, 2008 at 11:12 AM
Well have it parametrized into the settings would be the best. I just did it on the fly to avoid null description for SEO optimization.