Click here to Skip to main content
13,560,107 members
Click here to Skip to main content
Add your own
alternative version


14 bookmarked
Posted 15 Jan 2007

HTML Meta Tag Generator

, 15 Jan 2007
Rate this:
Please Sign up or sign in to vote.
Visual HTML Meta Tag Generator

Sample Image - Meta_Tag_Generator.jpg


Because of how often I need to generate Meta Tags for my web pages, and how difficult it is to remember all meta attributes (description, author... etc) I decided to write an application (small one) to do this job for me every time I need (create a new page for my sites).

This set of meta tags is not complete, a meta tag can have many different attributes, but this program i created is only for the ones i use most often(for full list of attributes: ask Google!)

I will generate the tags with only these attributes:
title, description, keywords, author, distribution and revisit

Let's start to create an Object - MetaTagObj to store all the information we need inside.
The code for MetaTagObj class is:

using System;

namespace MetaTagGenerator
    class MetaTagObj
        private string title;
        private string desc;
        private string keys;
        private string author;
        private string distribution;
        private string revisit;

        public string Title
            get { return title; }
            set { title = value.Trim(); }
        public string Desc
            get { return desc; }
            set { desc = value.Trim(); }
        public string Keys
            get { return keys; }
            set { keys = value.Trim(); }
        public string Author
            get { return author; }
            set { author = value.Trim(); }
        public string Distribution
            get { return distribution; }
                if (value.Trim() == "")
                    distribution = "Global";  //default value
                distribution = value.Trim(); 
        public string Revisit
            get { return revisit + " Days"; }
                if (value.Trim() == "")
                    revisit = "10";
                revisit = value.Trim();

        public MetaTagObj(): this("Title here", "Description Here", "", "", "", "")
        public MetaTagObj(string title, string desc, string keys, string author, string distribution, string revisit)
            Title = title;
            Desc = desc;
            Keys = keys;
            Author = author;
            Distribution = distribution;
            Revisit = revisit;
        public override string ToString()
            string MetaTag = "";
            MetaTag += "<title>"+ Title + "</title>" + Environment.NewLine;
            MetaTag += "<meta name=\"description\" content=\"" + Desc + "\" />" + Environment.NewLine;
            MetaTag += "<meta name=\"keywords\" content=\"" + Keys + "\" />" + Environment.NewLine;
            MetaTag += "<meta name=\"author\" content=\"" + Author + "\" />" + Environment.NewLine;
            MetaTag += "<meta name=\"distribution\" content=\"" + Distribution + "\" />" + Environment.NewLine;
            MetaTag += "<meta name=\"revisit-after\" content=\"" + Revisit + "\" />" + Environment.NewLine;

            return MetaTag;
In this class I do all the work for Meta tag creation (also, I include the TITLE tag here). This class is simple, two constructors, one with parameters, one empty. Some properties for private variables, with some default values (some of them).

The main form contains (screen capture on top of page) few TextBoxes, where the user can introduce data (values for specific attribute.), 3 buttons (Generate, Copy to Clipboard and About) and a TextBox (ReadOnly) for generated code!

. To use this program, you need to fill all the textboxes you want and to press the Generate Button. After this just Copy/Paste the code inside your HTML doc, on HEAD section.



This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Israel Israel
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralMy vote of 1 Pin
raphaelsainfocon12-Jun-09 23:43
memberraphaelsainfocon12-Jun-09 23:43 
GeneralMy vote of 1 Pin
BooGhost20-May-09 16:31
memberBooGhost20-May-09 16:31 
GeneralString concatenation Pin
Paulo Morgado16-Jan-07 21:54
memberPaulo Morgado16-Jan-07 21:54 
AnswerRe: String concatenation Pin
zeltera16-Jan-07 22:23
memberzeltera16-Jan-07 22:23 
GeneralRe: String concatenation Pin
Paulo Morgado17-Jan-07 13:22
memberPaulo Morgado17-Jan-07 13:22 
GeneralRe: String concatenation Pin
zeltera17-Jan-07 23:10
memberzeltera17-Jan-07 23:10 
GeneralRe: String concatenation Pin
zeltera18-Jan-07 0:04
memberzeltera18-Jan-07 0:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04 | 2.8.180527.3 | Last Updated 15 Jan 2007
Article Copyright 2007 by zeltera
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid