Hello World & hexo notes

Hello World & hexo notes

戳这里!

原模板自带简介

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

$ hexo new "My New Post"

More info: Writing

Run server

$ hexo server

More info: Server

Generate static files

$ hexo generate

More info: Generating

Deploy to remote sites

$ hexo deploy

More info: Deployment


以下为个人记录

常规操作类

生成并部署

$ hexo generate --deploy

清空本地生成

$ hexo clean

字号

调整_variables.styl文件

图片视频类

视频:iframe标签、或者video标签:

<embed type="video/mp4" allowscriptaccess="always" allowfullscreen="true" wmode="transparent" quality="high" height="300" width="480" src="http://7.com/3.mp4"/>

<iframe height=498 width=510 src=" " frameborder=0 allowfullscreen></iframe>

<video width="498" height="510 " src=" " poster=" " autoplay="autoplay"></video>

<embed src="/cht/css/images/banner-flash.swf" allowFullScreen="true" quality="high" width="480" height="400" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash"></embed>

加入置顶功能

node_modules/hexo-generator-index/lib/generator.js

'use strict';
var pagination = require('hexo-pagination');
module.exports = function(locals){
  var config = this.config;
  var posts = locals.posts;
    posts.data = posts.data.sort(function(a, b) {
        if(a.top && b.top) { // 两篇文章top都有定义
            if(a.top == b.top) return b.date - a.date; // 若top值一样则按照文章日期降序排
            else return b.top - a.top; // 否则按照top值降序排
        }
        else if(a.top && !b.top) { // 以下是只有一篇文章top有定义,那么将有top的排在前面(这里用异或操作居然不行233)
            return -1;
        }
        else if(!a.top && b.top) {
            return 1;
        }
        else return b.date - a.date; // 都没定义按照文章日期降序排
    });
  var paginationDir = config.pagination_dir || 'page';
  return pagination('', posts, {
    perPage: config.index_generator.per_page,
    layout: ['index', 'archive'],
    format: paginationDir + '/%d/',
    data: {
      __index: true
    }
  });
};

加入gallery功能,每次更新文件时需运行

python pcp.py
node tool.js
cd photos/page-backup
git add .
git commit -m 'upload'
git status -s
git push

关于asset-img文件夹的解决方案之一

http://www.tuicool.com/articles/umEBVfI 目前自己解决的办法是放到css/thumbnail绝对路径下,肯定没错就是有点不优雅

增加swf-flash文件作为banner功能:

·添加post/swf.ejs文件

<a href="<%- url_for((post.link ? post.link : post.title)) %>" target="_blank" itemprop="url" class="flash"></a>
	<embed src="<%- post.swf %>" allowFullScreen="true" quality="best" width="100%" height="100%" align="middle" allowScriptAccess="always" scale="noborder" type="application/x-shockwave-flash" class="flash-banner"></embed>

·修改article.ejs文件:

		<% if (post.swf) { %>
            <%- partial('post/swf') %>
        <% } %>

front-matter相关修改

noshare属性

<% if (!post.noshare) { %>
<% } %>

这样加入noshare属性并设置为true即可关闭分享功能

关于favicon.ico

这年代缩略图标各家差别太大

为了适配安卓和苹果,找到了一个好用的网站:http://realfavicongenerator.net/ 可以生成对应的html代码和图片文件。 有兴趣可以把本网站“添加到主屏幕”试试;-) 对了,还要修改_config.yml ,以及head.ejs文件相应位置哦

fancybox

http://fancyapps.com/fancybox/#docs 有众多属性可以使用,还可以点击播放swf

题外话:关于pip

easy_install -U pip

Chen Ting

Chen Ting

The page aimed to exhibit activities & achievements during Ting's undergraduate & graduate period. Meanwhile, other aspects such as lifestyles, literary work, travel notes, etc. would interweave in the narration.

Leave a Comment

Disqus might be GFW-ed. Excited!