Jekyll – Github Pages静态站点生成

内容纲要

Jekyll介绍

Jekyll是Ruby中支持博客的静态站点生成器

github仓库:https://github.com/jekyll/jekyll

网址:jekyllrb.com

Jekyll是一个简单的、支持博客的静态站点生成器,非常适合个人、项目或组织网站。可以把它想象成一个基于文件的CMS,没有那么复杂。Jekyll获取你的内容,渲染Markdown和Liquid模板,然后生成一个完整的静态网站,可以由Apache、Nginx或其他web服务器提供服务。Jekyll是GitHub Pages背后的引擎,你可以直接使用它来托管GitHub仓库中的网站。

查看: https://jekyllrb.com/philosophy

Philosophy
Jekyll offers a unique philosophy when approaching the problem of static site generation. This core philosophy drives development and product decisions. When a contributor, maintainer, or user asks herself what Jekyll is about, the following principles should come to mind:

  1. No Magic
    Jekyll is not magic. A user should be able to understand the underlying processes that make up the Jekyll build without much reading. It should do only what you ask it to and nothing more. When a user takes a certain action, the outcome should be easily understandable and focused.

  2. It “Just Works”
    The out-of-the-box experience should be that it “just works.” Run gem install jekyll and it should build any Jekyll site that it’s given. Features like auto-regeneration and settings like the markdown renderer should represent sane defaults that work perfectly for the vast majority of cases. The burden of initial configuration should not be placed on the user.

  3. Content is King
    Why is Jekyll so loved by content creators? It focuses on content first and foremost, making the process of publishing content on the Web easy. Users should find the management of their content enjoyable and simple.

  4. Stability
    If a user’s site builds today, it should build tomorrow. Backwards-compatibility should be strongly preferred over breaking changes. Breaking changes should be made to support a strong practical goal, and breaking changes should never be made to drive forward “purity” of the codebase, or other changes purely to make the maintainers’ lives easier. Breaking changes provide a significant amount of friction between upgrades and reduce the confidence of users in this software, and should thus be avoided unless absolutely necessary. Upon breaking changes, provide a clear path for users to upgrade.

  5. Small & Extensible
    The core of Jekyll should be simple and small, and extensibility should be a first-class feature to provide added functionality from community contributors. The core should be kept to features used by at least 90% of users–everything else should be provided as a plugin. New features should be shipped as plugins and focus should be put on creating extensible core API’s to support rich plugins.

Jekyll会照你说的做——不多也不少。它不会试图通过大胆的假设来胜过用户,也不会用不必要的复杂性和配置给用户带来负担。简而言之,Jekyll让你能够专注于真正重要的东西:内容。

CMS:内容管理系统

内容管理系统 (CMS) 可帮助公司管理数字内容,企业团队可以使用内容管理系统来创建、编辑、组织和发布内容。内容管理系统作为存储内容的单一平台,借助内置(或设计)的工作流程,为数字内容的协作式管理和创建提供自动化流程,并根据角色分配不同的权限和责任。例如,作者可以发布和保存作品,而编辑可以修改和发布作品;管理员可以执行所有这些操作,也可以授予组织中的其他人更新或修改内容的权限。

CMS 让企业可以在较低技术开销的情况下轻松创建和管理网站和网站内容,因此您可以制作更好的内容,而不是充当项目或流量经理。通过这种简单且具有成本效益的内容管理解决方案,企业可以自行管理和发布内容,而无需投资于全职内容开发团队。
https://www.oracle.com/cn/content-management/what-is-cms/
https://www.oracle.com/content-management/what-is-cms/

Jekyll入门指南

  • 安装gem
  • 阅读它的用法和配置
  • 看看一些现有的网站
  • Fork并贡献您自己的修改
  • 有问题吗?访问官方论坛社区Jekyll Talk和Libera IRC上的#Jekyll频道

安装gem

Installation:https://jekyllrb.com/docs/installation/

Jekyll是一个Ruby Gem,可以安装在大多数系统上。

要求

  • Ruby 版本2.5.0或更高,包括所有开发头(使用Ruby -v检查您的Ruby版本)
  • RubyGems(使用gem -v检查你的Gems版本)
  • GCCMake(使用gcc -vg++ -vmake -v检查您的版本)

安装指南

有关详细的安装说明,请按照您的操作系统指南进行。

阅读它的用法和配置

用法

The Jekyll gem makes a jekyll executable available to you in your terminal.

The jekyll program has several commands but the structure is always:

jekyll command [argument] [option] [argument_to_option]

Examples:
    jekyll new site/ --blank
    jekyll serve --config _alternative_config.yml

Typically you’ll use jekyll serve while developing locally and jekyll build when you need to generate the site for production.

For a full list of options and their argument, see Build Command Options.

Here are some of the most common commands:

  • jekyll new PATH - Creates a new Jekyll site with default gem-based theme at specified path. The directories will be created as necessary.
  • jekyll new PATH --blank - Creates a new blank Jekyll site scaffold at specified path.
  • jekyll build or jekyll b - Performs a one off build your site to ./_site (by default).
  • jekyll serve or jekyll s - Builds your site any time a source file changes and serves it locally.
  • jekyll clean - Removes all generated files: destination folder, metadata file, Sass and Jekyll caches.
  • jekyll help - Shows help, optionally for a given subcommand, e.g. jekyll help build.
  • jekyll new-theme - Creates a new Jekyll theme scaffold.
  • jekyll doctor - Outputs any deprecation or configuration issues.

To change Jekyll’s default build behavior have a look through the configuration options.

配置

Jekyll为您定制构建站点的方式提供了很大的灵活性。这些选项可以在放在站点的根目录中_config.yml_config.Toml文件中指定。或者可以指定为终端中jekyll可执行文件的标志。

看看一些现有的网站

看看其他人提出了什么设计和功能是很有趣的。这些链接指向由jekyll驱动的博客和网站。可以访问以下链接,从别人的博客中学习。

我们在Jekyll's showcase上整理了一些我们最喜欢的。

Leave a Comment

您的电子邮箱地址不会被公开。 必填项已用*标注

close
arrow_upward