BBEdit - easy hand-coding
I know I was intending to write about the making of the Morocco website, but I've been using a Mac (there are probably windows equivalents) text editor called BBEdit and it's amazing, so I want to write a few observations about it here.
Being quite a lazy type, I want to be able to update or change my pages with the least possible work, but I didn't want to lose the control you have with hand-coding. Style sheets obviously help a lot with that, but BBEdit does 'includes', which are much like Server Side Includes on the server side, but the include files are on your disk.
I made a template first, based on the home page, which has the basic structure of the pages on it, and this has includes for the head elements, the top of the page and the bottom of the page, so all I have to do is bung in the content for each new page. I can just alter the relevant include file and update the whole site with one click.
I know that to a geek all this is pretty basic, but it impresses the hell out of me, and the most impressive thing of all is that BBEdit enables a non-geek like me to do this kind of stuff. And it gets better.... The includes can also have variables. Naturally your pages aren't all the same, they will have differences in the head element, like the title and so on. These can be set when you first create the page, by putting in variables to the instruction to include a file.
For example, have a look at the source of the home page:
<!-- #bbinclude "head.html"
#KEYWORDS#="morocco, internet, remote"
#DESC#="Bringing internet access to a remote area in Morocco"
#TITL#="Tribal Networks - Communication Between Two Worlds" -->
(for some reason #TITLE# really screwed up the page, it must have some other function so I changed it)
It tells BBEdit to include the file head.html, and in that file, instead of putting in the actual keywords, title etc, I just put the string #KEYWORDS# or whatever. Then when BBEdit sees #KEYWORDS#="morocco, internet, remote" it replaces the #KEYWORDS# string with "morocco, internet, remote".... hmm, crappy choice of keywords there, I haven't got around to that part yet!
But anyway, this means that I can update pages without losing any of the variable content. I don't have to go through individual pages changing anything (except the content of course...). When I hit the 'update site" button, all the titles, keywords and anything else I'm using variables for is preserved, even though the structure of the pages, or anything else, might have been changed across the whole site.
It isn't any extra work even, to set this up once the includes and templates are done. I'd have to add keywords and titles and so on to each page anyway, I just put them somewhere else instead.
And there's more. I wanted to have a way of indicating which of the main pages the reader is actually on. You can do this with javascript, but I want to avoid that for as long as I can. The method is pretty rudimentary and I could only really apply it on the main pages, but if the site does get big and complex I could add a single line which will have the path to the current page, and put it anywhere on each page.
For the time being, in the navigation bar, the link to the current page has a class called "self" which does nothing at the moment. I tried a couple of things but they screwed up the layout in IE and so I lost my temper and moved on to other things. This is the strategy I have evolved for dealing with IE. It may not be the most efficient strategy, but it's the most satisfying.
I've also noticed a few things while using it that indicate a good, solid program. Recently I moved the folder which contains the include files, and forgot to tell BBEdit I'd done this. It didn't matter, everything still worked, and when I did remember and went to the preferences panes to tell it, the new path was already there. Most programs would choke on that, but BBEdit just quietly took care of it.
Some of this might sound complicated to some people, it did to me, but the documentation is excellent, had every detail I needed, and wasn't too geeky. I never had to resort to online searches to answer any questions I had.
Being quite a lazy type, I want to be able to update or change my pages with the least possible work, but I didn't want to lose the control you have with hand-coding. Style sheets obviously help a lot with that, but BBEdit does 'includes', which are much like Server Side Includes on the server side, but the include files are on your disk.
I made a template first, based on the home page, which has the basic structure of the pages on it, and this has includes for the head elements, the top of the page and the bottom of the page, so all I have to do is bung in the content for each new page. I can just alter the relevant include file and update the whole site with one click.
I know that to a geek all this is pretty basic, but it impresses the hell out of me, and the most impressive thing of all is that BBEdit enables a non-geek like me to do this kind of stuff. And it gets better.... The includes can also have variables. Naturally your pages aren't all the same, they will have differences in the head element, like the title and so on. These can be set when you first create the page, by putting in variables to the instruction to include a file.
For example, have a look at the source of the home page:
<!-- #bbinclude "head.html"
#KEYWORDS#="morocco, internet, remote"
#DESC#="Bringing internet access to a remote area in Morocco"
#TITL#="Tribal Networks - Communication Between Two Worlds" -->
(for some reason #TITLE# really screwed up the page, it must have some other function so I changed it)
It tells BBEdit to include the file head.html, and in that file, instead of putting in the actual keywords, title etc, I just put the string #KEYWORDS# or whatever. Then when BBEdit sees #KEYWORDS#="morocco, internet, remote" it replaces the #KEYWORDS# string with "morocco, internet, remote".... hmm, crappy choice of keywords there, I haven't got around to that part yet!
But anyway, this means that I can update pages without losing any of the variable content. I don't have to go through individual pages changing anything (except the content of course...). When I hit the 'update site" button, all the titles, keywords and anything else I'm using variables for is preserved, even though the structure of the pages, or anything else, might have been changed across the whole site.
It isn't any extra work even, to set this up once the includes and templates are done. I'd have to add keywords and titles and so on to each page anyway, I just put them somewhere else instead.
And there's more. I wanted to have a way of indicating which of the main pages the reader is actually on. You can do this with javascript, but I want to avoid that for as long as I can. The method is pretty rudimentary and I could only really apply it on the main pages, but if the site does get big and complex I could add a single line which will have the path to the current page, and put it anywhere on each page.
For the time being, in the navigation bar, the link to the current page has a class called "self" which does nothing at the moment. I tried a couple of things but they screwed up the layout in IE and so I lost my temper and moved on to other things. This is the strategy I have evolved for dealing with IE. It may not be the most efficient strategy, but it's the most satisfying.
I've also noticed a few things while using it that indicate a good, solid program. Recently I moved the folder which contains the include files, and forgot to tell BBEdit I'd done this. It didn't matter, everything still worked, and when I did remember and went to the preferences panes to tell it, the new path was already there. Most programs would choke on that, but BBEdit just quietly took care of it.
Some of this might sound complicated to some people, it did to me, but the documentation is excellent, had every detail I needed, and wasn't too geeky. I never had to resort to online searches to answer any questions I had.
Total Comments 0
Comments
Recent Blog Entries by zek
- Getting sucked in by google (September 26th, 2008)
- BBEdit - easy hand-coding (August 31st, 2008)
- Starting Tribal Networks Morocco Website (August 28th, 2008)
iEntry 10th Anniversary
Announcements









