vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
11.48k stars 1.86k forks source link

v1.0.1 lastUpdated can't show #3719

Closed Shuaiqizheng closed 1 month ago

Shuaiqizheng commented 1 month ago

Describe the bug

lastUpdatedtime can't show in v1.0.1

related config.mts :

import { defineConfig } from 'vitepress'

export default defineConfig({ lastUpdated: true , themeConfig: { lastUpdated: { text: '最后更新于', formatOptions: { dateStyle: 'short', timeStyle: 'medium' } } } })

Reproduction

1

Expected behavior

Please fix it!

System Info

1

Additional context

No response

Validations

brc-dd commented 1 month ago

Please provide a reproducible example. Your project should be a git repo and you should've committed your files for it to work.

Shuaiqizheng commented 1 month ago

Please provide a reproducible example. Your project should be a git repo and you should've committed your files for it to work.

this is all my files : https://github.com/pdbsdk/no-lastUpdated Please help me, thank you!

brc-dd commented 1 month ago

It's showing fine 👀

image
Shuaiqizheng commented 1 month ago

Oh my god! In my computer's and phone's broswer, it is showing this. 1711692467622 Do you also use vitepress v1.0.1 ?

Shuaiqizheng commented 1 month ago

It's showing fine 👀

image

Which version do you use ?

brc-dd commented 1 month ago

Yeah. I'm using 1.0.1. How are you building and previewing your project?

Can you verify if this command shows correct date for you:

git log -1 --pretty="%ai" "docs/no lastUpdated 1.md"

It should show you something like this:

image
Shuaiqizheng commented 1 month ago

Unbelievable! after our chat, without making any changes to my source files, everything suddenly started displaying correctly! However, this stroke of luck was limited to the demo project I shared with you. My actual website project still stubbornly refuses to display the update time, even after I've diligently copied over all the configurations from the demo. It wasn't until I executed the git command you provided that the light bulb went on. Turns out, the issue wasn't with the config file at all, but was sparked by the git repository path's mischievous hide-and-seek.The demo project eventually played nice because, in my eagerness to demonstrate the problem to you, I set the git repository path to 'C:\site'. On the other hand, the original project was throwing a tantrum because its git repository path was 'C:\site\docs.vitepress\dist'.Initially, my master plan was simply to upload the generated files; an oversight had the markdown source files lurking outside of git's watchful eye, rendering the update time display helpless.And the reason it 'magically' started working after our chat? Well, my git upload antics inadvertently waved a wand and fixed the issue. So there you have it, a heartfelt thank you is in order—you're my knight in shining code! Sending you a virtual high-five!