使用静态网站生成器在动态网站上创建博客?
我正在考虑在我的动态网站上设置博客/内容部分。使用像 Hyde 这样的静态网站生成器来生成网站的“静态内容部分”是否明智?
优点是:
- 对于其他一些人来说,
- 语法
- 使用与网站其他部分类似的堆栈来提交文章很容易/简单 - 在我的例子中,使用 Hyde 和与 django 模板相同的
I'm looking into having a blog/content section on my dynamic website. Is it sensible to use a static website generator like Hyde to generate the "static content part" of the website?
Advantages would be:
- easy/simple for a few other people to submit articles
- performance
- using a similar stack as the rest of the website - in my case, using Hyde and the same syntax as django templates
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我将使用 flatpages 应用程序来实现此目的。使用 Flatpages 应用程序,您仍然可以将内容(博客文章)直接放在 HTML 上,但您将拥有模板化的优势(使用您的基本网站模板或仅用于博客的自定义模板)。您还可以跟踪管理面板上有多少页面。您还可以将评论“外包”给 Disqus 之类的东西,并保持 dinamyc 的感觉。
不过我还是会认真思考你这样做的原因。从数据库获取博客文章并不是一个非常影响性能的操作,除非您的服务器过于紧张。
I would use the flatpages app for this. With the flatpages app you can still put your content (blog posts) directly on the HTML but you'll have the advantage of templating (using you base site template or just a custom one for the blog). You'll also be able to keep track of how many pages there are on the admin panels. You can also "outsource" comments to something like Disqus and maintain a dinamyc feel.
Still I would really think about the reason why you're doing this. Getting a blog post from a db isn't a very performance shattering operation unless your server is overly strained as it is.
你远不是第一个这样做的人。我仍然感觉 Ruby 的 Jekyll(其中 Hyde 是 Python 的“移植”)在这方面稍微领先一些,但我也有 Python / Django 背景,可以理解对同质性的渴望。
我能想到的大多数例子都是使用 Jekyll 的人完成的,但是 这篇博文介绍了一个人从 WordPress 迁移到他们似乎对 Hyde 很满意,还有 这个海德博客,这两个博客都可能为您提供一些有用的建议。 Disqus 似乎是首选的评论平台,您只需通过 在您的网站中嵌入一些 JavaScript,因此它是静态网站的一个完美解决方案。
实际上,我不认为“性能”是一个主要问题;我可能在这里对你不公平,但通常情况下,那些拥有足够博客流量导致性能问题的人都处于这样的状态:他们有足够的现金来配置缓存层/额外的服务器。对我来说,优势在于托管的灵活性(几乎任何人都会为您托管静态 HTML)和“安全性”(唯一执行服务器端的是网络服务器) 。
You'd be far from the first person to do this. It still very much feels to me like Ruby's Jekyll (of which Hyde is a Python 'port' of sorts) is a bit more ahead in this regard, but I also come from a Python / Django background and can understand the desire for some homogeneity.
Most examples I can think of are done with people using Jekyll, but this blog post covers one person's move from WordPress to Hyde that they seem quite happy with, and there's also this Hyde blog, both of which potentially have some useful advice for you. Disqus seems like the comment platform of choice, and you integrate it simply by embedding some JavaScript in your site, hence it's a beautiful solution for a static site.
Realistically I can't see "performance" as a major issue; I may be doing you an injustice here, but it generally seems like those with enough blog traffic to cause performance issues are in the state where they've got the cash to lob a caching layer / extra servers at it. For me, the advantage has been in the flexibility of hosting (pretty much anyone will host static HTML for you for very little) and 'security' (the only thing executing server-side will be the webserver).