我正在为我的个人网站制作投资组合部分。每个投资组合项目,其中有很多,看起来像这样:
<li>
<h3>Core Product</h3>
<ul>
<li>Snip</li>
<li>2011 to 2012</li>
</ul>
<%= link_to "http://sniphq.com/demo" %>
<p>
Snip is a company I started in January 2011.
I did all the programming, design, usability testing, sales, marketing—everything.
The overall idea is to allow hairstylists to spend more time on hair and less time on everything else.
</p>
</li>
我不喜欢这里的数据如何与数据的显示方式如此紧密地耦合在一起。如果我能做这样的事情,我会很整洁:
snip:
client_name: Snip
project_name: Core Product
period: 2011 to 2012
link: http://sniphq.com/demo
description: Snip is a company I...
然后在我看来,我可以遍历这些项目。我意识到我可以为投资组合项目创建一个数据库表,但这对我作为内容编写者来说更难维护,而且作为程序员也比我需要的更复杂。
实现这种功能的最佳/最简单的方法是什么?