这是本博客第一次建站的报告,也当是自己做网页历程的一个小结吧。
之前考虑过用GoogleAppEngine以及其他类似的免费云计算平台来搭建,但是免费的只找到了GAE。本来对Py就不熟,网上流行的micolog(一个用Python写的模板)也不方便修改。最后选择了GitHub Pages作为主机(GitCafé类似)。
在GitHub上建立网站通过Jekyll(Ruby写成的用于生成静态网页的工具)来完成,首选的模板有Octopress和JekyllBootstrap,他们的官方网站上有丰富的模板,而且由于是Ruby写的,跨平台性很好!
本机运行Octopress后发现,_config.yml里面设置项目繁多,想达到高度自定制化也不是那么容易;JekyllBootstrap效果不错,推荐使用。不过自己最后选择的还是DIY,因为之前那段时间比较闲。
下面简单说说我与网页的历史吧:
最开始制作网页还是5年前,那时候CSS+DIV架构刚兴起,我也只是个初中生,没有学那么多,只会用FrontPage 2003可视化编辑html(后来也用过SharePoint Designer 2007,由于都是不接触代码的,用起来觉得很方便,现在看来真是弱爆了,因为代码编辑器的功能不够强大,CSS3和HTML5支持很弱,建议大家改用Dreamweaver CS6),网页架构也是用表格的,用表格就会发现浏览器窗口缩放时表格就变形了,网页文字图片布局什么的也跟着变形了。于是发现编辑器提供了画框架的功能,就是<div>标签。
那时候也经常到JS特效站上去粘贴点特效到html里面,但是每次运行都会被IE浏览器拦截,要手动运行,很麻烦,现在IE放开了某些JS的运行,不需要去弄什么网站安全证书了,方便了很多。
当时做什么动态特效基本上不是用JS就是用Flash了,也经常有一起用的,图片什么的用Fireworks直接搞定,后来发现Fw的切片功能能生成网页而且就是CSS+DIV架构的,所以觉得一定要好好利用这个功能。于是当时参加比赛的网页基本上都是图片切片堆出来的。
还有一个有意思的现象就是那时候网页上的圆形按钮看代码其实是切成了矩形的,因为多边形切片占用很大的代码,但是现在CSS3直接就能创建圆形按钮了。光从鼠标指针的变化上就能觉得很舒服。
本站的制作过程:
偶然间发现我的昵称MewX的org域名没有被注册,我就赶紧注册了。
注册之后我并没有考虑租用服务器,因为去年租用过一个虚拟主机,感觉性能不是很好,过一定时间访问就可能访问异常,需要唤醒时间才能正常浏览。而且,仅仅租用300M的空间我就用不完。
主流的博客、论坛模板都是asp、php写的,动态并且依赖数据库,但是经过一年使用发现,数据库利用率实在低的可怜,非要弄一个服务器实属浪费。
偶然间听Phonzia说弄了个网站主机在Github Pages上,我也就决定充分利用这个平台建一个站~~
(Github Page Repository的建立可以去搜索引擎上找、)
(Jekyll 的Hello World样例可以去搜索引擎上找、)
前面也说过了,没有采用现成的模板,于是准备靠老本来建站了,毕竟从来做的就是静态网站,这会主机又把我限定在静态页面上了,所以我可以专心写静态页面了。
由于好几年没有写网页了,通过这几年的上网经验,发现现在做网页动画效果很丰富啊,动画没有执行完毕还可以原路径返回呢。以前做这样的效果得要好多行JS脚本呢。现在据了解是CSS3脚本,执行全靠浏览器了,功能不仅强大,还非常方便。于是就在谷歌上搜到了一个叫W3Schools(http://w3schools.com)的网站上学习,非常详细的网站,每个技术内容学习就几个页面就完成了,入门很轻松。(后来发现国内很多山寨站,比如W3School、W3CSchool这样的,全部都是从这个网站上Copy过来的。)
早有耳闻的CSS+DIV架构,我也觉得应该好好实践了,于是就从头到尾用<div>标签搭建了这个网站。
我极力追求页面的动画效果(以前没有好好享受过),于是遇到了瓶颈,因为CSS3不支持全局的动画,也就是说动画只能和自身相关,不能动别的元素的奶酪。。所以在学习别人网站的源码时发现了jQuery这个库,同样在W3Schools这个网站上入门了这个库,做成了右上角那个动态语言切换按钮。这个库弥补了CSS3的不足,动画效果相比以前的做法绝对是一流的。
P.S. 关于语言的切换会在以后的更新中完成,目前难度不是很大,因为Liquid语言掌握的差不多了,只要用Liquid筛选文件名或者post.title就可以做到。
制作的重头戏就是右侧的几个按钮,这几个按钮使用了CSS3脚本W3C最新标准的tricks,那就是将before和after标签做成动画元素,把before和after都加入hover效果。具体可以看本站源码framwork.css样式表的注释,你会受益匪浅的。当然,我这里做的很大程度上也是从别的站上学来的。
网页制作还是要多看别人好的网站的源码才能学到很多不知道的技术 _(:з」∠)_。
最后也欢迎来访者评论、提建议、push本站源码。(LISENCE: GPLv2)
This is the very first build report for this blog, and also a little recap of my journey in web design.
Before this, I considered using Google App Engine and other similar free cloud computing platforms to host the site, but GAE was the only free one I found. I wasn’t familiar with Python to begin with, and micolog (a popular Python-based blog template online) wasn’t easy to customize either. In the end, I chose GitHub Pages as my host (GitCafé is similar).
Building a site on GitHub is done with Jekyll (a static site generator written in Ruby). The top starter templates are Octopress and JekyllBootstrap—their official sites offer plenty of themes, and since it’s written in Ruby, cross-platform compatibility is great!
After running Octopress locally, I found that _config.yml was packed with configuration options, making deep customization not all that easy. JekyllBootstrap looks pretty good and is worth recommending. Still, I ended up going the DIY route, mostly because I had plenty of free time back then.
Here’s a quick rundown of my history with web design:
I first started making webpages 5 years ago, right when the CSS+DIV layout approach was taking off. I was just a middle schooler back then and didn’t know much—I only knew how to edit HTML visually in FrontPage 2003 (and later SharePoint Designer 2007). Since neither required touching code, they felt super convenient at the time; looking back now, they were totally lame because their code editors were underpowered and their CSS3 and HTML5 support was terrible—I’d recommend switching to Dreamweaver CS6 instead. Page layouts back then were also built with tables, and with tables, the moment you resized the browser window, the whole table would warp, throwing off all the text and image placement along with it. That’s when I discovered the editor’s frame-drawing feature—namely, the <div> tag.
Back then, I also used to grab JavaScript effects from JS snippet sites and paste them into my HTML, but IE would block them every single time and force you to allow them manually, which was a huge pain. Nowadays IE has loosened up on certain JS execution so you don’t have to mess with website security certificates anymore, making things much easier.
In those days, dynamic effects were pretty much done with either JS or Flash, and often both together. Images and graphics were handled straight in Fireworks; later I realized Fireworks’ slice tool could export full webpages using a CSS+DIV layout, so I thought I definitely had to put that feature to good use. As a result, the webpages I made for competitions back then were basically cobbled together out of image slices.
Another funny thing from back then: if you looked at the code for round buttons on webpages, they were actually sliced as rectangles, because polygonal slices took up a ton of code. Today, CSS3 can create round buttons directly—even just seeing how the mouse cursor responds feels so satisfying.
How this site was built:
By chance, I noticed the .org domain for my handle MewX hadn’t been registered yet, so I snapped it up right away.
After registering it, I didn’t bother renting a server. I had rented shared hosting the year before, and the performance wasn’t great—after sitting idle for a while, visits would error out and it needed warm-up time before loading properly. Besides, I couldn’t even fill up the 300MB of storage I rented.
Most mainstream blog and forum templates are written in ASP or PHP, dynamic and backed by databases. Yet after a year of using one, I realized my database utilization was pitifully low—paying for a full server would be a total waste.
Then I happened to hear from Phonzia that they’d set up a site hosted on GitHub Pages, so I decided to make full use of this platform and build a site of my own~~
(You can search online for how to set up a GitHub Pages Repository.)
(You can search online for Jekyll Hello World examples.)
As mentioned earlier, I didn’t use a ready-made template, so I fell back on my old skills to build the site from scratch. After all, I’d always made static sites anyway, and since this host restricts me to static pages, I could focus purely on writing static pages.
Having not written webpages for several years, I’d noticed from browsing the web recently just how rich webpage animations had become—an animation can even smoothly reverse back along its path if interrupted mid-way! Pulling that off used to take tons of lines of JS. Now I learned it’s all done with CSS3, executed entirely by the browser—not only powerful, but super convenient. So I searched on Google and found a site called W3Schools (http://w3schools.com) to learn from. It’s a super thorough site where each topic only takes a few pages to get through, making it effortless to get started. (Later I noticed tons of domestic copycat sites like W3School and W3CSchool—all straight-up copied from this site.)
Having heard so much about CSS+DIV architecture, I figured it was time to put it into practice properly, so I built this entire website from start to finish with <div> tags.
I went all-in chasing slick page animations (something I never really got to enjoy before), and soon hit a bottleneck: CSS3 doesn’t support global animations, meaning an animation can only apply to the element itself and can’t touch another element’s cheese.. While studying the source code of other people’s sites, I discovered the jQuery library, picked up the basics on W3Schools as well, and used it to build the animated language-switcher button in the top-right corner. jQuery fills in CSS3’s gaps nicely, and its animation effects are top-notch compared to the old ways.
P.S. The actual language switching will be implemented in a future update. It shouldn’t be too hard now that I’ve mostly mastered Liquid—filtering by filename or post.title in Liquid will do the trick.
The centerpiece of this build is the set of buttons on the right side. They use the latest W3C CSS3 tricks—turning ::before and ::after pseudo-elements into animated elements and adding :hover effects to both. You can check the comments in this site’s framwork.css stylesheet for the details; you’ll learn a lot from it. Of course, a big part of what I did here was also learned from other websites.
When it comes to web development, you really have to inspect the source code of other great sites to pick up techniques you never knew existed _(:з」∠)_.
Finally, visitors are always welcome to leave comments, offer suggestions, or push to this site’s source code. (LICENSE: GPLv2)