0
所以我',我遇到了一個問題HEXO不返回使用靜態網站發生器hexo.io post.categories或post.tags
在索引頁我想只顯示其職位類別是「秀」 。 我在.md文件中指定了類別,如官方文檔中所示。
---
layout: post
title: "doors"
categories:
- show
date: 2016-10-02 17:54:22
header-img: "1.jpg"
author: "default"
---
但似乎類別沒有得到分配,因爲當嘗試這樣
<% site.posts.each(function(post){ %>
<div class="post-preview col-md-4 col-xs-12">
<h2 class="post-title">
<%- post.categories || "Untitled" %>
<% console.log(post.categories)%>
</h2>
<% }); %>
在<h2>
顯示它我得到[object Object]
而不是文本show
。 當我試圖安慰post.categories
我獲得以下控制檯輸出
Query { data: [], length: 0 }
Query { data: [], length: 0 }
Query { data: [], length: 0 }
Query { data: [], length: 0 }
Query { data: [], length: 0 }
Query {
data:
[ Document {
name: 'show',
_id: 'citstcz9q000f8zi5oij9o5dg',
slug: [Getter],
path: [Getter],
permalink: [Getter],
posts: [Getter],
length: [Getter] } ],
length: 1 }
Query { data: [], length: 0 }
誰能告訴我什麼IAM做錯了什麼?