7 ms·
Hand Coding A Personal Website
- mox1 13y agoI came to the same conclusion as the author recently, which spurred me to write a simple, no frills lightweight CMS. For those interested you can see it at https://github.com/mox1/webpy-bootstrap-blog https://github.com/mox1/webpy-bootstrap-blog Personally, I think there's a middle ground somewhere between writing everything yourself and using hosted Wordpress. I want to control the HTML / CSS of the pages on my site, but I don't want to end up in a WYSIWYG environment where all the details are hidden.
- ozh 13y agoI've rarely seen such an off topic introductory image, but I'm more surprised to see that kind of very beginner info land on HN front page. Nicely written and everything, but... HN?
- binarymax 13y agoGood for you - keep learning! Knowing how things are built from scratch will give you a level of understanding that will help in all sorts of situations. However, I am at the opposite end of the spectrum. I have never used a template or boilerplate or anything. Every time I've tried to use a prefab site I end up spending hours tearing it apart and feel like I am going backwards. That being said, I cannot really recommend my approach - find a happy middle, and your productivity will soar.
- nmc 13y agoNice tutorial, I just disagree on two small points. First, there are very sound arguments for not using CSS preprocessors [1]. Second, for a website that you own, using ".htaccess" is discouraged for performances reasons. The Apache 2.4 docs [2] say: "You should avoid using .htaccess files completely if you have access to httpd main server config file. Using .htaccess files slows down your Apache http server. Any directive that you can include in a .htaccess file is better set in a Directory block, as it will have the same effect with better performance." [1] http://blog.millermedeiros.com/the-problem-with-css-pre-processors/ http://blog.millermedeiros.com/the-problem-with-css-pre-proc... [2] http://httpd.apache.org/docs/2.4/howto/htaccess.html http://httpd.apache.org/docs/2.4/howto/htaccess.html
- laumars 13y ago> Second, for a website that you own, using ".htaccess" is discouraged for performances reasons. Agreed, and not just for performance reasons but security as well. While a correct set up wouldn't allow write access to the docs root nor developers to copy up hidden files, sometimes a sysadmin drops the ball. So disabling the use of .htaccess files prevents an attacker from changing your Apache configuration without gaining root access (and if that happens, then it's already game over).
- pyalot2 13y agoThe benefit of having some (any) facility to be able to write non vendor prefix/semantic infested CSS and to have nesting take care of an otherwise entirely unmaintainable flat CSS selector soup so far outweights any drawback that whatever argument you'll contrieve to construct against CSS preprocessors is essentially null, nill and invalid.
- petewailes 13y agoI can't agree with the first. Most of the arguments from the quoted post are the result of bad practice with preprocessing, not preprocessing itself. For example, the "Dumb code duplication is dumb" example is just someone writing things badly. It should have been written as: .error-default, .error-special { @include error; } .error-special { background-color: #fcc; } Similar arguments can be made for most of the other points. The nesting part for example seems to imply that you'd write in LESS/SASS etc, then maintain the post-processed CSS - whereas obviously you'd be maintaining the pre-processed files. Not convinced, personally. Disclosure: I actively develop a CSS framework built explicitly around the functionality of preprocessors.
- pyalot2 13y agoHaving written pages, by hand, for ages now (like 15 years or so), I recently took this to a new level. I'm now hosting my site on my own hand coded webserver and no other server in front (please don't make me explain).
- imdsm 13y agoPlease DO explain. I'm going to guess at a PHP based site? I couldn't imagine trying to run my personal website (https://github.com/Imdsm/PersonalWebsite/ https://github.com/Imdsm/PersonalWebsite/) on a hand-written web server and database server, though if I did that would be an achievement.
- laumars 13y agoIt could be something like Go or Java which would provide the basic framework for you and "all" you need to do is write the handlers (this is how my latest project is written) rather than writing their own HTTP classes and just using the languages TCP/IP libraries. However I too would be interested in reading more about the previous commenter's set up.
- ptr 13y agoThe first library I did for my compiled experimental PL was a HTTP server, pretty similar to what you describe. I wonder about the performance and reliability of libraries like those (Go's http package, Ruby Sinatra/WEBrick, etc.); if they can be used in production.
- profil 13y agoPlease explain! And if you dont want to explain, please show some code? This sounds really interesting.
- pyalot2 13y agoWell here goes. My site is this http://codeflow.org/ http://codeflow.org/ I haven't been terribly happy with Apache, it's, fast-ish, but configuring it is pain. Also dispatching dynamic requests via (whatever mod-wsgi or something) isn't quite as fast. I've run cherokee for the last couple of years, but have my own grievances with that (doesn't support gzip+content-length, impossible to hand edit configuration, kinda slow, that kind of thing again). I've had run-ins with nginx, and it's pretty cool, except configuring it is a giant pain. Also, it still isn't dispatching dynamic requests as fast as could be (goes trough a socket to another process or whatever). Then there's stuff that no webserver out there does really satisfactory, which is low-latency websockets. Reason is that they proxy the websockets trough to another process, and even though it's on the local machine, this just drives latency up by whole dozens of milliseconds... Ok, so what's my obsession with speed all about? My capital is strictly limited, so I've got to run whatever I want to run on my own VPS. Unfortunately I started running http://webglstats.com/ http://webglstats.com/ the tracker of which is embedded in some 500 other sites. They shuffle traffic me at a rate of between 5-10 stat impressions per second, and each of those triggers 3 requests (two gets, one post). I concurrently run around 50-150 open connections at all times. So naturally I'd want the tracker to run as fast as I can, and I'd like my other web properties not to slow down because I run a high-traffic service on that server. And I found that pretty much everything out there just isn't very good at that. So having had finally enough after years, I wrote my own. It's about 1500 lines of python, it's asynchronous, can do http-pipelining, has a dynamic dispatch router that can do things like vhosts, has an inotify integration so it avoids stat'ing static files all the time, it lets me plug python modules directly into the webserver (so no more subprocesses/sockets/fastcgi/whatever for dynamic requests). It does around 4000 requests/s, it easily does at least 512 concurrent open connections, it peaks at a troughput on localhost of +300mb/s and it does that while maintaining a maximum latency (on localhost) of 2ms, or outside (across about 6 hops) of around 15ms. I'm happy with that, and now that the I spent the last two weeks writing that server (it's not the first I wrote, but I finally took the leap), I'm 100% sure that whatever problem I encounter in my hosting adventures, I can make my server solve them.
- modern_privacy 13y agoNice. I built websites as a teen and had my own webserver, but within time my interests changed more to other subjects. But as of late, I've been thinking about making a personal website again, instead of using a variety of services (github, flickr, tumblr etc.). This really helped me to spark my motivation again, thanks!
- walshemj 13y agoSo your hand coding but using in OpenDAWS doesn't that defeat the purpose of doing it all yourself from first principals?
- insertnickname 13y ago*principles
- youWontLikeThis 13y ago*you're
- walshemj 13y agoso I am dyslexic sue me :-) BTW was hand coding sites back in 94 :-)
- mailarchis 13y agoI did something similar few months. I've been developing webapps using django for a while now. But my frontend skills (html/css) had always been very rusty. I decided to improve it by building a personal website without using any frontend framework or doing any server side development. It was an interesting exercise. The output is here - http://archisman.com/ http://archisman.com/
- sdegutis 13y agoThe title made me think this was gonna be minimalistic, something like <html><head><title>My Great Website</title></head><body><h1>Hello world!</h1><p>Find ye great content yonder.</p></body></html> so I was surprised to see it using LESS and delving into .htaccess
- dlwiest 13y agoI was about to link this to a friend, who has been using Wordpress and expressed interest in learning more about how websites work, and then OP got into installing a local Apache server and using LESS to compile CSS, and I'm afraid it might intimidate her, since she's already hesitant about her capacity for learning this sort of thing. I'm not sure why either was brought up though. If OP is comfortable with these tools and wanted to write about his own experience, I could understand, but for the sake of a tutorial, what benefit does adding these complications, which present a risk of alienating some segment of the tutorial's audience, provide? Unless you need a back end language, you don't need to install a local Apache server; you can run html files directly from whatever folder they're stored in, and if you link with relative paths, you can transfer the whole directory to a live server and it will still work fine, and for the amount of rules a beginner will probably write for a small, personal website, using LESS is probably overkill. Furthermore, anyone who's comfortable with either of these practices would have no problem adapting them to a basic "building a website with a grid framework" tutorial, and everyone else can pick them up later, when their value becomes more apparent. It reminds me a little of the way every Javascript tutorial I find lately seems to assume that you're running a Node.js server. Outside of maybe the HN crowd, are most people running Node servers? I doubt it. And it's almost never necessary; you don't need Node to configure routing or build some custom directives in Angular, for example, so why insist that people use it?
- Bahamut 13y agoNode provides some very handy tools for working locally. For example, usage of Bower, the client-side dependency, uses Node. Node also adds the ability to do nifty stuff like utilizing Livereload for automatically refreshing a page when you make an edit to a file. I will admit, using all these tools was initially intimidating for me, but getting comfortable with them was extremely rewarding.
- dlwiest 13y agoOh, there's no question that local Apache and Node servers can be valuable tools, but if you're trying to teach your reader something that doesn't strictly require them, why risk alienating people who aren't familiar? How many people who just want to learn how two way binding works are going to see a Node.js server as a "requirement" and move on?
- adav 13y agoI haven't developed for the front-end web in a while, but is it considered hand-coding if a boilerplate this-or-that is used at every stage?
- rickr 13y agoThat was my first thought. I'm also kind of confused at who this is for...the author is a designer and assumes a firm knowledge of HTML/CSS. How do you obtain that knowledge without doing anything outside of a CMS?
- aaronem 13y agoQuite easily, if you've made a business out of designing Wordpress themes; part of Wordpress's value proposition is, more or less, "you can make your site look exactly how you want it to, without needing to know anything about PHP except how to copy-paste these chunks of boilerplate where you want things to happen."
- footpath 13y agoJust like to add that if you're using FileZilla as your FTP client, make sure to not let it save your passwords, as FileZilla stores them in plaintext on the computer. https://forum.filezilla-project.org/viewtopic.php?t=30765 https://forum.filezilla-project.org/viewtopic.php?t=30765
- krapp 13y agoOne way I found around this is to run filezilla from a script which copies the password file out of an encrypted drive then nulls the file when you're done: https://gist.github.com/kennethrapp/7e58f10e149786baf06c https://gist.github.com/kennethrapp/7e58f10e149786baf06c (I can't find the site I got this from though - and just not saving passwords probably would be better)