从wordpress主题创建octopress主题 [英] Creating an octopress theme from a wordpress theme

查看:72
本文介绍了从wordpress主题创建octopress主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用wordpress一段时间了,想尝试一些不同的东西.输入我对静态网站生成世界的发现.现在,我将目光投向Octopress,我知道它是基于jekyll构建的.在开始染上红宝石之前,我想知道是否有可能将我的当前 wordpress主题翻译成一个静态网站.

Ive been using wordpress for awhile now and wanted to try something different. Enter in my discovery of the world of static website generates. Now I have my eyes on Octopress which I know to be built on jekyll. Before I start getting dirty in ruby I want to know if its relatively possible to translate my current wordpress theme to a static site.

推荐答案

这正是我最近所做的:

http://eduncan911.com/blog

我复制了几乎相同设计的朋友的Wordpress主题(经许可):

I copied a friend's Wordpress theme (with permission) of almost the same design:

http://forgetfoo.com

要回答您的第一个问题,答案是肯定的.这就是让Jekyll在这类事情上如此出色的原因:它只是几个目录中的原始HTML,css和js.将它们放置在您喜欢的任何位置,然后开始减少包含中的部分,包装一些插件,等等,在您不了解之前,您就是rake generaterake deploy.

To answer your first concern, the answer is a big ol' YES. That's what make Jekyll so good for these kind of things: it's just raw HTML and css and js in a few directories. Place them anywhere you like, and start cutting away at chunks in includes, wrap some plugins, etc and before you know it, you are rake generate and rake deploy.

Octopress通过提供大量插件,已经构建了类似博客的模板系统***(请参见下文),以及用于博客的所有默认设置,使其变得更加甜美.

Octopress makes it even sweeter by having a large number of plugins, a blog-like template system already structured*** (see below), and bunch of defaults all setup for blogging.

Octopress主题的问题如上所述,它纯粹是设置为博客平台.您需要高度修改,或者在我的情况下,完全忽略它们所拥有的模板,而只需将它们附带的漂亮的Github Pages,SCSS和插件带回去,然后滚动自己的html模板即可.这真的非常非常容易.

The issue with Octopress' theme is as I said above, it is purely setup as a blogging platform. You'd need to highly modify, or in my case just completely ignore, the template they have and just piggy back on the nice Github Pages, SCSS, and plugins it comes with and roll your own html templates. It's really really really easy.

/source/index.html

您从此YAML文件开始.在顶部是layout的定义,该定义用于选择要使用的包装".或您希望以此包围index.html内容的布局.要制作一个像您一样的新模板,我将其命名为layout: fuse_homepage.然后进入source/_layouts/并创建一个新的`fuse_homepage.html'.

You start here with this YAML file. At the top is a definition of layout, which is used to pick what "wrapper" or layout you want to surround this index.html content with. To make a new template, one like yours, I'd call it layout: fuse_homepage. Then go into source/_layouts/ and create a new `fuse_homepage.html'.

但是,您甚至不必这样做.地狱,只将整个首页HTML粘贴正确 首先进入source/index.html(确保将--- YAML标记保持在顶部,但要摆脱布局).从那里开始,然后在您厌倦了应对和粘贴页眉/页脚时再进行讨论.哎呀,就从这里开始-制作一个fuse_header.html和fuse_footer.html并暂时共享它们.

But see, you don't even have to do that. Hell, just paste your entire homepage HTML right into that source/index.html to start with (make sure to keep the --- YAML markers at the top, but get rid of the layout). Start there and break things out later when you get tired of coping and pasting the header/footers. Heck, just start there - make a fuse_header.html and fuse_footer.html and just share those for now.

忽略Octopress的主题布局-仅适用于不做UX而只想调整事物的黑客.想要控制自己代码的设计师或人们将希望自己动手.

Ignore Octopress' theme layout - it's just for hackers that don't do UX and just want to tweak things. Designers or people that like to control their code will want to roll your own.

真的很灵活.但是,您可以拆分它,可以.想要一个新页面,只需调用rake new_page["title"],这一切取决于创建的/title.html/title/index.html,具体取决于您在配置文件中的设置.但请看,您甚至不必这样做.只需自己创建文件-BAM,即可在部署时将其复制.

It really is that flexible. However you want to break it up, you can. Want a new page, just call rake new_page["title"], which all this does is create either an /title.html, or /title/index.html, depending on your settings in the config file. But see, you don't even have to do that. Just create the file yourself - BAM, it is copied on deployment.

我只后悔尝试遵循Octopress的作者格式-浪费了很多时间,因此在Octopress中被关闭了.最后,我只是忽略了它,做了自己的事情.容易得多,而且我知道所有内容都在哪里.我还想要漂亮且整洁的HTML-我关心我的代码的显示.默认的Octorpess主题和结构邀请了很多错误放置的制表符和空格,以至于很难看.自己做,您完全可以控制,只需插入很少的空格即可.

I only regret trying to follow the Octopress' author's format - wasted so much time and got so turned off at Octopress. In the end, I just ignored it and did my own. Much easier, and I know where everything is. I also wanted nice and cleanly formatted HTML - a show that I care about my code. The default Octorpess theme and structure invites so many mis-placed tabs and spaces that it's just ugly. Doing your own, you are in full control, space by little space insert.

有大量的Google链接可帮助您从Wordpress导出WRX,并自动生成帖子文件.准备尝试几种不同的方法,因为它们并不完美.

There's a huge amount of Google links to help you export your WRX from Wordpress, and to generate a the post files automagically. Be prepared to try several different ones as they aren't all perfect.

除非您已经在Wordpress上使用了Disqus,否则您将度过一个痛苦的时刻.

Unless you are already using Disqus on Wordpress, you are going to have a horrible time with this one.

在我进行了近100次导入,导出和修复等尝试之后,我现在可以声称自己是WRX/BlogML专家.在任何一个导入器(Disqus或Wordpress)上都没有文档可以告诉您各个必填字段.例如,Wordpress要求设置wp:comment_id,并且对于您导入的每个帖子都是唯一的,而Disqus要求设置wp:comment_email字段,即使该字段是可选的(BS,argh)也是如此.

I can now claim myself to be an WRX/BlogML expert after my nearly 100 tries of importing and exporting and fixing and so on. There is no documentation on either importer (Disqus nor Wordpress) to tell you of the individual required fields. For example, Wordpress requires wp:comment_id to be set, and unique for each and every post you import whereas Disqus requires an wp:comment_email field, even though say it is optional (it's BS, argh).

请注意:在静态站点周围进行大量的工作.自己制作模板将为您节省大量时间.您可能还想编写自己的自定义插件,以解决人们在github回购协议中的错误-这很简单,但确实需要编码.

Do note though: it is a lot of work to hack around the static site. Doing your own template will save you so much time. You'll also may want to write your own custom plugins, which I did, to get around the bugs in peoples github repos - it's pretty easy, but does require coding.

我花了大约一个月的时间,直到我将新的博客/静态网站放到我喜欢的网站上进行发布为止.比我想要的要多得多,但这是有趣"的.学习新的语言(Ruby,Python,在VM中安装Debian linux导致Windows糟透了这些东西).

I spent about a month off and on until I got my new blog/static site to where I liked it for launch. A lot more than I wanted, but it was "fun" learning new languages (Ruby, Python, installed Debian linux in a VM cause Windows just sucks at that stuff).

如果您不准备写那么多文字,那么在我写博客时,还有更多静态站点生成器(嘿,必须炫耀我的Octopress和自定义主题!):

If you aren't prepared to write that much, there are a couple more static site generators out there as I blogged about (hey, got to show off my Octopress and custom theme!):

http://eduncan911.com/software/the-static-blog -boom.html

顺便说一句,不错的网站...

Btw, nice site...

这篇关于从wordpress主题创建octopress主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆