I'd like to share with others a discovery I made about using meta tags for other purposes than SEO.
My issue was to have a number of articles shown in exactly the order I wanted them to be listed. I also wanted that certain articles shoule be shown as subarticles under main articles (sorted as parents and children). it could be done simple to make a list of links, but then one would have to alter that list every time one added an article. I got the solution when I became aware of the PHP function get_meta_tags(). That function will find and list all the meta tags in an HTML document. - So I added lines like these to my documents:

<meta name="title" content="Title of the document">
<meta name="parent" content="0">
<meta name="number" content="8">

or maybe:

<meta name="title" content="Title of the document">
<meta name="parent" content="8">
<meta name="number" content="8c">

The first of these documents will have no parent; it's a main document. The second will have document no. 8 as parent, and it will be (maybe) no. 3 child under no. 8.

Now let some PHP find all the files in a folder, use the get_meta_tags for each file, make arrays out of the results together with the url of each file, and multisort the arrays. Then let PHP present the list, properly indenting the children. I shall not go into detail here about the PHP. My main object is to draw attention to a nice way of using meta tags. One can see an example of this use at geltzer.dk/nigeria. Here also some folders have been made to show in the order I want it, but that is another matter.

4 Years
Discussion Span
Last Post by diafol

I like the idea, but I'm assuming php needs to open every file and read the meta tags. Isn't that a bit slow? Would it be quicker (not necessarily easier) to store page data in a DB (the order, section etc, being stored with it). and then inject that into the meta tags (opposite of what you're doing) on page load?
I can see the approach working on static pages, but I would imagine many sites these days use templates, with something like the following:


An admin form would make organizing the pages / orders / sections straighforward. Whereas in your approach, if you change a section or order, you'd have to change the html within your pages. Just a thought.

Edited by diafol


Actually I have been trying to see how far I could get without using a database. You must be right that the function get_meta_tags must have to open each single file, but I have not noticed any slowness for that reason, maybe because my site is not that great.
I don't quite understand that about an admin form. Could you explain?


Don't think that I'm dismissing the technique, not at all.

WRT Admin Form:

With some CMSes, the pages are listed in a table, along with details such as title, description (and the antiquated keywords). The table links to a form that allows you add attributes. You could build a variation on a theme:

So your form fields for a page could be:

(filename with path)
(The text to be displayed on the browser tab)
(The description in the meta tag)
(The section in which a link to it should be found, e.g. 8)
(The position of the link within the section, e.g. 4)

The section field typically would be dropdown holding the id values of all sections in the DB
The last field could just be a 'selectable' list box, where you could move the page up and down the list.

There are many ways in which you could do this. Your method seems to work for you, so while it continues to do so, enjoy it! :)


Thank you so much for bothering to answer my question. Your method seems to be at least as good as mine. Only that one would have to alter the table each time one wrote a new article. For the time being I think I'll go on enjoying my own approach.

Edited by johslind


Only that one would have to alter the table each time one wrote a new article.

Not really, you just add a new page (register) in the form. It shouldn't change your DB structure nor do you have to hard code anything. But as you say, keep enjoying your own approach!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.