Bloggers Get More and More CMS Start Your Static Blog From Logecho

Source: Internet
Author: User
Tags aliyun archive archives block blog bloggers cms compared

Intermediary trading http://www.aliyun.com/zixun/aggregation/6858.html"> SEO diagnostic Taobao customer hosting technology hall

Why static?

Compared to the rise of all kinds of social networking sites, personal blog platform has begun to enter a more profound process of self-transformation. Since I personally have been involved in this process, I can feel the impact it brings.

Systems headed by Wordpress will increasingly become CMS-based and inevitably more and more bloated. Ghost, led by the new platform, but the focus shifted to write experience to build.

In this process there is a strange, that is static blog system. Web page static seems to run counter to the increasing media presence today, but its emergence frees freelancers from cumbersome and unnecessary system maintenance, allowing everyone to focus more on content, As for the sharing and dissemination of content can be handed over to more social platforms.

What is Logecho?

Yes, you now see my site as an all-static Web site built by Logecho that runs on any server that supports static websites (basically all) or on a platform that is hosted statically like github.io . Do not need any server configuration, finished writing can be released directly.

This is another blogging software I developed after Typecho and is still in testing phase. If you can not wait to use it, please read the following text.

How to get started

Note that Logecho's native runtime requires PHP 5.4+ support, but you should not be concerned if you're running the latest Mac OSX system. In addition, our command line mode does not support Windows, please note that.

Because it's still under test, you have to first clone the code from github

git clone https://github.com/typecho/logecho.git

Then compile an executable file

cd logecho && php build.php

You can now see logecho such an executable file in the current directory, run it to see some basic usage

$ ./logecho

LOGECHO 1.0.0

Copyright (c) 2013-2014 Logecho (http://logecho.com)

usage: logecho (init | build | sync | serve | help | update | import) [your-working-directory]

In fact, this file is all about logecho. You can copy it to any location you want, or add it to an environment variable, so that you can use a command such as logecho directly from anywhere.

Initialize a directory

mkdir blog

logecho init blog

This blog directory is initialized, its structure is

blog /

├── _theme

│ ├── archives.twig

│ ├── footer.twig

│ ├── header.twig

│ ├── index.twig

│ ├── post.twig

│ └── style.css

├── config.yaml

└── posts

└── hello-world.md

It can be intuitively understood from the literal meaning

_theme directory is placed in the template file, Logecho uses Twig template engine

The posts directory is placed article documents are markdown format

config.yaml is a configuration file, I will explain it later

Profile

# You can configure this file to customize your site

globals:

# Definition of global variable

title: My Blog Site

description: Yet another logecho site

url: http://logecho.com/

blocks:

# All blocks to compile

post:

source: / posts /

target: / posts /

category:

source:

default: Default

template: archives.twig

target: archives.html

tag:

template: archives.twig

target: archives.html

archive:

template: archives.twig

target: archives.html

index:

template: index.twig

target: index.html

limit: 10

feeds:

# Definition of feeds gererating

source: post

recently: 20

target: feeds.xml

author: Logecho

build:

# The commands running after compile

- cp -f @ THEME / style.css @ TARGET / style.css

sync:

# The commands running with sync operation

Here is a sample configuration file, from top to bottom

globals

Here you can set all the global variables, it is important to note that there is no default global variable in Logecho, the value you set here is only for your convenience to call the corresponding variable from the template.

blocks

Here used to set all the content sources and compile relations, it has four main types, used to describe the relationship between content and archives. Content is such as articles, pages and other carriers, the archive is such as categories, labels and the like. We achieve a combination of the two by defining different blocks

Set source to a directory: This type will be automatically recognized by logecho as content, and all the postscript suffixed by .md will be read from this directory where you set it.

Set source to a hash structure: This type will be considered as an archive, and the scope of the archive will be in your default hash structure

Do not set source: This type will be considered archiving, scope convention, as long as appear in the article will be archived

Special archive: This is a default archive type, all articles will be archived in the month under this type

Special index archive: This is also a default archive type, the latest entries of all content will be archived to this block, you can set a limit to specify the number of records it contains, if you do not set the default limit For 10 It can also be a hash structure, used to specify different content contains different numbers.

Compile target target

Each block will set a target, which is generated file target, it can be a file can also be a directory, if it is a directory logecho will automatically generate a single file per entry, if it is a file logecho will all The entry is generated into a file.

Note: Logecho will judge whether it is a directory at the end of the string. If you do not set the target, logecho will automatically compile the block into an html file whose type is its name, such as tag will be compiled into tag.html.

Related content and archives

In an article, such as hello-world.md file with the following syntax can be the forefront of this content associated with the corresponding archive

@category: default

@tag: php, redis

....

The above syntax will be associated with this content under the category named default and below the tag named php and redis, where category must be associated with the name you specified in source, and tag can be associated with any name without specifying source.

Template file

Logecho uses the Twig template system.

Each block must specify a template file, the home page template file will be automatically identified as index.twig. If you do not specify the corresponding block template file, logecho will automatically specify a twig file with its type as the file name, for example, the tag template will be identified as tag.twig.

You can use the following variables in the template

All variables defined in globals

The current block generated variables

The variables generated for the current block follow the following principles

The name of the variable is the block name

For example, in the corresponding post.twig post, you can directly use the {{post.title}} syntax to call the post variable related properties.

In the archive page by target type to read

In front of the explanation of the config, target can be set as a directory, can also be set to a single file, when it is a directory, the current block variable is taken out of a standard hash structure

For example in category.twig, you can use {{category.name}} to invoke the category's attributes.

But if it is a directory, then the block variable is an array, you need to loop out the syntax of each element

For example in category.twig you need

{% for cat in category%}

{{cat.name}}

{% endfor%}

Other orders

build

logecho build / your-blog-dir /

It will generate all the target files based on your configuration

serve

logecho serve / your-blog-dir /

It will first create all the target files, and then start a mini http server to facilitate your direct preview of your web page. You can visit http: // localhost: 7000 / directly

sync

logecho sync / your-blog-dir /

Will be completed after the implementation of build, and then execute config.yaml you set the sync command

import

logecho import http: // your-blog-domain / your-blog-dir /

Import any blog that supports the xmlrpc interface locally

update

logecho update

Automatic update process (not completed)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.