Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2009-12-02 21:23:21
- leafy_loader
- Member
- Registered: 2008-09-25
- Posts: 96
Document title and textpattern
I want my client to be able to edit their sites html title tag in the head of the document.
Not sure how to approach this but the idea I’m currently toying with is to create a category and name it doc_titles, then create sub categories, eg home_title, about-us_title etc. Then use articles to create the words that appear between the <title></title> tags.
Is this a wise approach is there a better or standard way of doing this?
Offline
Re: Document title and textpattern
Well, I think that will lead to something really difficult to manage.
Try to define a little more what/when/where your client needs to edit the <title>
tag.
Is it on each individual article? Or he wants to play with them on pages that are not individual articles (like section frontpage, home, category listings, etc)?
Anyway, let’s try a first approach, which could be improved further and be written on a long one-liner… if you dare to:
<txp:if_individual_article>
<txp:if_custom_field name="super_custom_title">
<title><txp:custom_field name="super_custom_title" /></title> <!-- your client will be free to custom the whole <title> using a custom field -->
<txp:else />
<title><txp:title /> | <txp:section /> | <txp:site_name /></title> <!-- a more common, predefined <title> content -->
</txp:if_custom_field>
</txp:if_individual_article>
<txp:if_article_list>
<txp:if_section name=""><!-- if we are at website's homepage -->
<title><txp:variable name='default_title' /></title>
<txp:else />
<txp:if_category>
<title><txp:variable name='<txp:category />_title' /></title>
<txp:else /><!-- probably we are looking at a section front page -->
<title><txp:variable name='<txp:section />_title' /></title>
</txp:if_category>
</txp:if_section>
</txp:if_article_list>
Then, you will need grab the plugin adi_variables, which will let your client create and administer txp:variables using a nice interface. Follow the plugin instructions to create a few variables, like “default_title”, “fruits_title”, “about-us_title”, and so on…
And you are almost done.
Let us know how it goes, and eventually, we could refine this further.
Offline
#3 2009-12-02 22:03:15
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Document title and textpattern
Using forms would be simpler, but I don’t know if you want your client to have access to forms. If not, articles is also a good approach, you could make them sticky to make sure they don’t show up accidentally in article lists. If you want to use the article body, don’t forget to turn Textile off for those articles.
Edit: Julián was faster ;) (and more elaborate…)
Last edited by els (2009-12-02 22:03:48)
Offline
#4 2009-12-02 22:36:51
- leafy_loader
- Member
- Registered: 2008-09-25
- Posts: 96
Re: Document title and textpattern
hey thats a great little plugin! I wish I’d known about it earlier could have used it.
I’m going to set the titles by section and category and use the articles’ title if the variable hasn’t been set. The client will set the variables via your suggested plugin But it will have to be attempted tomorrow, too tired now.
Thanks for your help
Offline
Re: Document title and textpattern
How about adi_variables
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
Pages: 1