Skip to content

Commit

Permalink
update NotFound + fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Mar 12, 2023
1 parent 91d6324 commit ad8b0e7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .vitepress/genFeed.ts
Expand Up @@ -20,7 +20,7 @@ const feed = new Feed({

load(true).then((posts) => {
posts.forEach((post) => {
const file = path.resolve(dirname, `dist${post.href}`)
const file = path.resolve(dirname, `dist${post.href}.html`)
const rendered = readFileSync(file, 'utf-8')
const content = rendered.match(
/<div [^<>]+?class="prose[^<>]+?>([\s\S]*)<\/div><\/div><footer/
Expand Down
20 changes: 12 additions & 8 deletions .vitepress/theme/Layout.vue
@@ -1,13 +1,11 @@
<script setup lang="ts">
import { computed } from 'vue'
import { useRoute } from 'vitepress'
import { useData } from 'vitepress'
import Home from './Home.vue'
import Article from './Article.vue'
import NotFound from './NotFound.vue'
const route = useRoute()
const isIndex = computed(() => route.path.replace(/index.html$/, '') === '/')
const isNotFound = computed(() => route.component === NotFound)
const { page, frontmatter } = useData()
</script>

<template>
Expand All @@ -21,7 +19,11 @@ const isNotFound = computed(() => route.component === NotFound)
alt="logo"
src="/logo.svg"
/>
<span v-if="!isIndex" class="hidden md:inline dark:text-white">The Vue Point</span>
<span
v-if="!frontmatter.index"
class="hidden md:inline dark:text-white"
>The Vue Point</span
>
</a>
<div class="text-sm text-gray-500 dark:text-white leading-5">
<a
Expand All @@ -32,7 +34,9 @@ const isNotFound = computed(() => route.component === NotFound)
><span class="hidden sm:inline">GitHub </span>Source</a
>
<span class="mr-2 ml-2">·</span>
<a class="hover:text-gray-700 dark:hover:text-gray-200" href="/feed.rss"
<a
class="hover:text-gray-700 dark:hover:text-gray-200"
href="/feed.rss"
>RSS<span class="hidden sm:inline"> Feed</span></a
>
<span class="mr-2 ml-2">·</span>
Expand All @@ -47,8 +51,8 @@ const isNotFound = computed(() => route.component === NotFound)
</nav>
</div>
<main class="max-w-3xl mx-auto px-4 sm:px-6 xl:max-w-5xl xl:px-0">
<Home v-if="isIndex" />
<NotFound v-else-if="isNotFound" />
<Home v-if="frontmatter.index" />
<NotFound v-else-if="page.isNotFound" />
<Article v-else />
</main>
</div>
Expand Down
5 changes: 1 addition & 4 deletions .vitepress/theme/index.ts
@@ -1,9 +1,6 @@
import './style.css'

import Layout from './Layout.vue'
import NotFound from './NotFound.vue'

export default {
Layout,
NotFound
Layout
}
3 changes: 2 additions & 1 deletion index.md
@@ -1,4 +1,5 @@
---
title: The Vue Point
subtext: Updates, tips & opinions from the maintainers of Vue.js.
---
index: true
---

1 comment on commit ad8b0e7

@vercel
Copy link

@vercel vercel bot commented on ad8b0e7 Mar 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

blog – ./

blog-rho-five-21.vercel.app
blog-git-main-vuejs.vercel.app
blog.vuejs.org

Please sign in to comment.