npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hexo-generator-restful-zhaoo

v0.1.1

Published

Generate RESTful json data for Hexo plugins, fit for hexo-theme-zhaoo & hexo-weapp-zhaoo.

Downloads

4

Readme

hexo-generator-restful-zhaoo

基于 hexo-generator-restful

Generate restful json data for Hexo plugins. Fit for hexo-theme-zhaoo & hexo-weapp-zhaoo

生成 restful 风格的 json 数据,可以当作 api 接口,zhaoo 主题适配版。

Install

npm install hexo-generator-restful-zhaoo --save

Config

以下为默认配置,属性值为 false 表示不生成。

restful:
  # site 可配置为数组选择性生成某些属性
  # site: ['title', 'subtitle', 'description', 'author', 'since', email', 'favicon', 'avatar']
  site: true        # hexo.config mix theme.config
  posts_size: 10    # 文章列表分页,0 表示不分页
  posts_props:      # 文章列表项的需要生成的属性
    title: true
    slug: true
    date: true
    updated: true
    comments: true
    path: true
    excerpt: false
    cover: true      # 封面图,取文章第一张图片
    content: false
    keywords: false
    categories: true
    tags: true
  categories: true         # 分类数据
  use_category_slug: false # Use slug for filename of category data
  tags: true               # 标签数据
  use_tag_slug: false      # Use slug for filename of tag data
  post: true               # 文章数据
  pages: false             # 额外的 Hexo 页面数据, 如 About
  galleries: false         # 相册数据 

Document

Get Hexo Config

获取所有 Hexo 配置(站点配置和主题配置)。

Request
GET /api/site.json
Response

/api/site.json

Get Posts

如果配置 posts_size: 0 则不分页,以下请求会获取全部文章。

Request
GET /api/posts.json
Response

示例为分页配置下的数据,会包含分页属性 totalpageSizepageCount,不分页的数据不包含这三项。

/api/posts.json

Get Posts By Page

获取分页数据

Request
GET /api/posts/:PageNum.json
Response

/api/posts/1.json

Get All Tags

获取所有文章标签,如果文章无标签则不生成。

Request
GET /api/tags.json
Response

/api/tags.json

Get Posts By Tag

获取某一标签下的所有文章

Request
GET /api/tags/:TagName.json
Response

/api/tags/Hexo.json

Get All Categories

获取所有文章分类,如果文章无分类则不生成。

Request
GET /api/categories.json
Response

数据格式同 Get All Tags

Get Posts By Categorie

获取某一分类下的所有文章

Request
GET /api/categories/:CategorieName.json
Response

数据格式同 Get Posts By Tag

Get Post By Slug

根据文章别名获取文章详细信息

Request
GET /api/articles/:Slug.json
Response

/api/articles/javascript-advanced-functions.json

Get Implecit Pages

获取来自主题的 Hexo 隐式页面内容,如 About 等。因隐式页面(除 About 等导航栏入口页外)一般在 Hexo 不提供直接访问入口,调用此 API 的开发者需要了解其完整路径,此接口默认关闭。

例如:

Request
GET /api/pages/about.json
Response

格式类似于于 Get Post By Slug。

Get All Galleries

获取所有相册分类。

Request
GET /api/galleries.json
Response

/api/galleries.json

Get Gallerie By Name

根据相册名称获取相册详细内容

Request
GET /api/galleries/:Name.json
Response

/api/galleries/colorful.json

Get All Photos

获取所有照片(不分类)。

Request
GET /api/galleries/all.json
Response

/api/galleries/all.json