airene / vitepress-blog-pure

a vitepress theme for blog, demo ↓
https://ti.bi
MIT License
168 stars 25 forks source link

Question: where is the article object assigned/defined? #10

Closed kwatog closed 1 year ago

kwatog commented 1 year ago

apologies for a stupid question but I'd like to know where article object is initiated. thanks!

            <a :href="withBase(article.regularPath)" v-for="(article, index) in yearList" :key="index" class="article">
                <div class="title">
                    <div class="title-o"></div>
                    {{ article.frontMatter.title }}
                </div>
                <div class="date">{{ article.frontMatter.date.slice(5) }}</div>
            </a>
airene commented 1 year ago

Haha, never mind. it's ok. The title is in the *.md file , eg:

---
date: 2021-06-30
title: some title here
tags:
- vitepress
- markdown
description: sss
---

like this,https://raw.githubusercontent.com/airene/vitepress-blog-pure/main/posts/vitepress-first.md

in '---' paragraph ,vitepress maybe call baseinfo , and it's aboult frontMatter markdown-it tech.

kwatog commented 1 year ago

thanks, @airene , yeah. saw the frontmatter.

about the article, I realized it's the yearList which is from useYearSort(theme.value.posts).

I failed to trace properly.

thanks again. this rep is a great start in understanding theming in vitepress.