hexo底层json数据内容

为了便于开发hexo主题,在此记录下hexo启动后,基本的参数内容。

因为几乎都是json格式,熟悉了过后,用ejs写代码去实现自己想要的功能,两个字:带劲。

page

{
  title: 'now',
  date: Moment<2023-04-13T23:30:27+08:00>,
  _content: '',
  source: 'now/index.md',
  raw: '',
  updated: Moment<2023-04-21T12:08:08+08:00>,
  path: 'now/index.html',
  comments: true,
  layout: 'page',
  _id: '',
  content: '具体内容',
  site: { data: {} },
  excerpt: '',
  more: '',
  permalink: 'https://www.ninojay.top/now/index.html',
  full_source: '/Users/cengzhongjie/Desktop/website/source/now/index.md',
  __page: true,
  lang: 'en',
  canonical_path: 'now/index.html'
}

page(is_post() == true)

{
  title: 'hexo底层json数据内容',
  date: Moment<2023-04-21T12:49:00+08:00>,
  _content: '',
  source: '_posts/2023/hexo-date-inside.md',
  raw: '',
  slug: '2023/hexo-date-inside',
  published: true,
  updated: Moment<2023-04-21T12:56:33+08:00>,
  _id: '',
  comments: true,
  layout: 'post',
  photos: [],
  link: '',
  content: '',
  site: { data: {} },
  excerpt: '',
  more: '',
  path: '2023/hexo-date-inside/',
  permalink: 'https://www.ninojay.top/2023/hexo-date-inside/',
  full_source: '/Users/cengzhongjie/Desktop/website/source/_posts/2023/hexo-date-inside.md',
  asset_dir: '/Users/cengzhongjie/Desktop/website/source/_posts/2023/hexo-date-inside/',
  tags: _Query {
    data: [ [_Document], [_Document], [_Document], [_Document] ],
    length: 4
  },
  categories: _Query { data: [ [_Document] ], length: 1 },
  next: <ref *1> _Document {
    title: '这个世界真的能消灭贫困吗?',
    date: Moment<2023-04-20T20:17:00+08:00>,
    _content: '',
    source: '_posts/2023/ask-why-no-more-peaceful-person.md',
    raw: '',
    slug: '2023/ask-why-no-more-peaceful-person',
    published: true,
    updated: Moment<2023-04-21T10:31:50+08:00>,
    _id: '',
    comments: true,
    layout: 'post',
    photos: [],
    link: '',
    content: '',
    site: { data: {} },
    excerpt: '',
    more: '',
    path: [Getter],
    permalink: [Getter],
    full_source: [Getter],
    asset_dir: [Getter],
    tags: [Getter],
    categories: [Getter],
    prev: _Document {
      title: 'hexo底层json数据内容',
      date: Moment<2023-04-21T12:49:00+08:00>,
      _content: '',
      source: '_posts/2023/hexo-date-inside.md',
      raw: '',
      slug: '2023/hexo-date-inside',
      published: true,
      updated: Moment<2023-04-21T12:56:33+08:00>,
      _id: '',
      comments: true,
      layout: 'post',
      photos: [],
      link: '',
      content: '',
      site: [Object],
      excerpt: '',
      more: '',
      path: [Getter],
      permalink: [Getter],
      full_source: [Getter],
      asset_dir: [Getter],
      tags: [Getter],
      categories: [Getter],
      next: [Circular *1],
      __post: true
    },
    next: _Document {
      title: '手把手教你搭建轻型个人网站(0)——前言',
      date: Moment<2023-04-19T13:45:00+08:00>,
      _content: '',
      source: '_posts/2023/how-to-deploy-your-own-website-0.md',
      raw: '',
      slug: '2023/how-to-deploy-your-own-website-0',
      published: true,
      updated: Moment<2023-04-21T12:50:39+08:00>,
      _id: 'clgq2pcx20008inqt63x2a5i1',
      comments: true,
      layout: 'post',
      photos: [],
      link: '',
      content: '',
      path: [Getter],
      permalink: [Getter],
      full_source: [Getter],
      asset_dir: [Getter],
      tags: [Getter],
      categories: [Getter],
      prev: [Circular *1],
      next: [_Document],
      __post: true
    },
    __post: true
  },
  __post: true,
  lang: 'en',
  canonical_path: '2023/hexo-date-inside/index.html'
}

page.tags

_Query {
  data: [
    _Document {
      name: '互联网',
      _id: '',
      slug: [Getter], // 互联网
      path: [Getter], // tags/工具使用/
      permalink: [Getter], // https://www.ninojay.top/tags/%E6%80%9D%E8%80%83/
      posts: [Getter], //见下
      length: [Getter] // 1 代表这个标签下的post数目
    },
    _Document {
      name: '工具使用',
      _id: '',
      slug: [Getter],
      path: [Getter], 
      permalink: [Getter],
      posts: [Getter],
      length: [Getter]
    },
    _Document {
      name: '搭建网站',
      _id: '',
      slug: [Getter],
      path: [Getter],
      permalink: [Getter],
      posts: [Getter],
      length: [Getter]
    },
    _Document {
      name: 'hexo',
      _id: '',
      slug: [Getter],
      path: [Getter],
      permalink: [Getter],
      posts: [Getter],
      length: [Getter]
    }
  ],
  length: 4
}


page.tags.data[0].posts

_Query {
  data: [
    _Document {
      title: '这个世界真的能消灭贫困吗?',
      date: Moment<2023-04-20T20:17:00+08:00>,
      _content: '',
      source: '',
      slug: '2023/ask-why-no-more-peaceful-person',
      published: true,
      updated: Moment<2023-04-21T10:31:50+08:00>,
      _id: '',
      comments: true,
      layout: 'post',
      photos: [],
      link: '',
      content: '',
      site: [Object],
      excerpt: '',
      more: '',
      path: [Getter],
      permalink: [Getter],
      full_source: [Getter],
      asset_dir: [Getter],
      tags: [Getter],
      categories: [Getter],
      prev: [_Document],
      next: [_Document],
      __post: true
    }
  ],
  length: 1
}

page.categoires

_Query {
  data: [
    _Document {
      name: '思辨',
      _id: '',
      slug: [Getter], // 思辨
      path: [Getter], // categories/思辨/
      permalink: [Getter],  // https://www.ninojay.top/categories/%E6%80%9D%E8%BE%A8/
      posts: [Getter],
      length: [Getter] // 7 代表该分类下post数量
    }
  ],
  length: 1
}

page.categories.data[0].posts

_Query {
  data: [
    _Document {
      title: '食01-小炒肉',
      date: Moment<2022-03-31T14:27:36+08:00>,
      banner: '/img/postImages/xiaochaorou.jpg',
      _content: '',
      source: '_posts/2022/stir-fried-pork.md',
      raw: '',
      slug: '2022/stir-fried-pork',
      published: true,
      updated: Moment<2023-04-19T03:11:22+08:00>,
      comments: true,
      layout: 'post',
      photos: [],
      link: '',
      _id: '',
      content: '',
      path: [Getter],
      permalink: [Getter],
      full_source: [Getter],
      asset_dir: [Getter],
      tags: [Getter],
      categories: [Getter],
      prev: [_Document],
      next: [_Document],
      __post: true
    }
  ],
  length: 1
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值