Skip to content

Instantly share code, notes, and snippets.

@mh61503891 mh61503891/meta.js
Last active Jul 20, 2017

What would you like to do?
List all tags, categories, and posts in Hexo for Front-Matters of Markdown Writer
// See:
// Path: scripts/meta.js
// Author: Masayuki Higashino
// License: MIT
hexo.extend.generator.register('meta', function(locals) {
var meta = {
tags: [],
posts: [],
categories: []
locals.tags.sort('name').each(function(tag) {
locals.categories.sort('name').each(function(category) {
locals.posts.sort('name').each(function(post) {
title: post.title,
url: encodeURI(post.permalink),
date: post.updated.toDate().toISOString() ||
return {path: 'meta.json', data: JSON.stringify(meta)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.