创建自定义主页 Creating a custom home page
为你的网站创建一个自定义的主页是一个让你从人群中脱颖而出的好方法,并把你自己独特的印记存放在你的网上。本教程向您展示了如何在Ghost中自定义和开发自己的自定义主页。
Creating a custom home page for your site is a great way to set yourself apart from the crowd and put your own unique stamp on your online presence. This tutorial shows you how to customise and develop your own custom home page in Ghost.
创建和自定义模板 Creating and customising your template
在我们开始之前,我想先解释一下处理Ghost主题的几个先决条件。Ghost中的主题使用Handlebars,这是一种模板语言,提供对Ghost内容的访问和其他常见模板好处。
Before we dive in there's a couple of prerequisites I'd like to explain for working with Ghost themes. Themes in Ghost use Handlebars, a templating language that provides access to Ghost content and other common templating benefits.
主题文件结构和索引。 index.hbs file
Theme file structure and index.hbs file
每一个Ghost主题都有一个索引。hbs文件,“hbs”代表把手。此文件呈现您的所有帖子,并且最有可能用于您站点的主页。
Every Ghost theme comes with an index.hbs
file, the "hbs" stands for handlebars. This file renders all your posts, and is most likely being used on the home page of your site.
在Ghost admin中下载主题UI
Download theme UI in the Ghost admin
通过下载您的Ghost主题,您可以对该文件进行更改。要下载主题,请浏览Ghost admin中的Design视图,向下滚动到选择的主题,然后单击右侧的“download”。一旦你解压缩了主题,你就可以打开索引了。在文本编辑器中的hbs文件,并开始进行更改。
By downloading your Ghost theme you can make changes to this file. To download the theme navigate to the Design view in the Ghost admin and scroll down to the selected theme and click "download" on the right hand side. Once you've unzipped the theme you can open the index.hbs
file in a text editor and begin making changes.
{{!-- Main --}}
<main id="main"> <div>
<h2>Hey