I had a comment about my HTML the other day, it was a fairly valid one about how to make the source code a little more legible, and that I should indent it.
Maybe I should, but this got me thinking I should buckle down and make it more legible and neater, heck I am a designer after all.
I opened Coda to take a look and see how I can improve my code and realised I do try and make it as legible as I can, BUT in the CMS format.
The majority of sites I create are in CMS called Textpattern and therefore contains alot of txp tags to generate links and dynamic content.
A normal list of links might look like this
<ol>
<li><a class="active" href="#">An ordered</a></li>
<li><a href="#">list of</a></li>
<li><a href="#">Links</a></li>
</ol>
Great, Job Done!
<ol>
<li <txp:if_section name="ordered">class="active"</txp:if_section>>
<a href="<txp:section />/An ordered/">An ordered</a>
</li>
<li <txp:if_section name="list">class="active"</txp:if_section>>
<a href="<txp:section />/An ordered/">list of</a>
</li>
<li <txp:if_section name="links">class="active"</txp:if_section>>
<a href="<txp:section />/An ordered/">Links</a>
</li>
</ol>
So you can see I’m breaking down each ‘function’ to a line on its own so that when I come back to it later I can make better sense of what I’ve done.
Below is what the outputted code will look like, still acceptable but not as easy to read as the first example.
<ol>
<li>
<a class="active" href="#">An ordered</a>
</li>
<li>
<a href="#">list of</a>
</li>
<li>
<a href="#">Links</a>
</li>
</ol>
The example above is very simple and I have some quite complex statements on some sites that will cause the HTML to look awful, but it works and google can read it. I can still indent my code but I don’t think I’ll change my CMS coding habits a great deal.
This is not gospel and I’m by no means preaching as everyone has their way of coding, how do you do yours?
cms, code, layout, textpattern27 January 2012
On a recent project we were tasked with creating a web app for a presentation...
17 January 2012
I often get asked to look through existing websites to evaluate for new work. After...
14 November 2011
As web designers, UX designers or what ever we call ourselves these days, we have...
Comments