Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 2bdb39b

Browse files
authored
feat: add microdatas (#64)
1 parent 53bb5f9 commit 2bdb39b

File tree

3 files changed

+93
-46
lines changed

3 files changed

+93
-46
lines changed

components/PostMeta.vue

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
<template>
22
<div class="post-meta">
3-
<div v-if="author" class="post-meta-author">
4-
<NavigationIcon /> {{ author }}
5-
<span v-if="location"> &nbsp; in {{ location }}</span>
3+
<div
4+
v-if="author"
5+
class="post-meta-author"
6+
itemprop="publisher author"
7+
itemtype="http://schema.org/Person"
8+
itemscope
9+
>
10+
<NavigationIcon />
11+
<span itemprop="name">{{ author }}</span>
12+
<span v-if="location" itemprop="address"> &nbsp; in {{ location }}</span>
613
</div>
714
<div v-if="date" class="post-meta-date">
8-
<ClockIcon /> {{ resolvedDate }}
15+
<ClockIcon />
16+
<time pubdate itemprop="datePublished" :datetime="date">
17+
{{ resolvedDate }}
18+
</time>
919
</div>
10-
<ul v-if="tags" class="post-meta-tags">
20+
<ul v-if="tags" class="post-meta-tags" itemprop="keywords">
1121
<PostTag v-for="tag in resolvedTags" :key="tag" :tag="tag" />
1222
</ul>
1323
</div>

global-components/BaseListLayout.vue

+55-28
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,67 @@
11
<template>
22
<div id="base-list-layout">
3-
<div class="ui-posts">
4-
<div v-for="page in pages" :key="page.key" class="ui-post">
5-
<div class="ui-post-title">
3+
<div class="ui-posts" itemscope itemtype="http://schema.org/Blog">
4+
<article
5+
v-for="page in pages"
6+
:key="page.key"
7+
class="ui-post"
8+
itemprop="blogPost"
9+
itemscope
10+
itemtype="https://schema.org/BlogPosting"
11+
>
12+
<meta itemprop="mainEntityOfPage" :content="page.path" />
13+
14+
<header class="ui-post-title" itemprop="name headline">
615
<NavLink :link="page.path">{{ page.title }}</NavLink>
7-
</div>
16+
</header>
817

9-
<p class="ui-post-summary">
18+
<p class="ui-post-summary" itemprop="description">
1019
{{ page.frontmatter.summary || page.summary }}
1120
<!-- <Content :page-key="page.key" slot-key="intro"/>-->
1221
</p>
1322

14-
<div v-if="page.frontmatter.author" class="ui-post-meta ui-post-author">
15-
<NavigationIcon />
16-
<span>{{ page.frontmatter.author }}</span>
17-
<span v-if="page.frontmatter.location">
18-
&nbsp; in {{ page.frontmatter.location }}
19-
</span>
20-
</div>
21-
22-
<div v-if="page.frontmatter.date" class="ui-post-meta ui-post-date">
23-
<ClockIcon />
24-
<span>{{ resolvePostDate(page.frontmatter.date) }}</span>
25-
</div>
26-
27-
<div v-if="page.frontmatter.tags" class="ui-post-meta ui-post-tag">
28-
<TagIcon />
29-
<router-link
30-
v-for="tag in resolvePostTags(page.frontmatter.tags)"
31-
:key="tag"
32-
:to="'/tag/' + tag"
23+
<footer>
24+
<div
25+
v-if="page.frontmatter.author"
26+
class="ui-post-meta ui-post-author"
27+
itemprop="publisher author"
28+
itemtype="http://schema.org/Person"
29+
itemscope
3330
>
34-
{{ tag }}
35-
</router-link>
36-
</div>
37-
</div>
31+
<NavigationIcon />
32+
<span itemprop="name">{{ page.frontmatter.author }}</span>
33+
<span v-if="page.frontmatter.location" itemprop="address">
34+
&nbsp; in {{ page.frontmatter.location }}
35+
</span>
36+
</div>
37+
38+
<div v-if="page.frontmatter.date" class="ui-post-meta ui-post-date">
39+
<ClockIcon />
40+
<time
41+
pubdate
42+
itemprop="datePublished"
43+
:datetime="page.frontmatter.date"
44+
>
45+
{{ resolvePostDate(page.frontmatter.date) }}
46+
</time>
47+
</div>
48+
49+
<div
50+
v-if="page.frontmatter.tags"
51+
class="ui-post-meta ui-post-tag"
52+
itemprop="keywords"
53+
>
54+
<TagIcon />
55+
<router-link
56+
v-for="tag in resolvePostTags(page.frontmatter.tags)"
57+
:key="tag"
58+
:to="'/tag/' + tag"
59+
>
60+
{{ tag }}
61+
</router-link>
62+
</div>
63+
</footer>
64+
</article>
3865
</div>
3966

4067
<component

layouts/Post.vue

+23-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
<template>
22
<div id="vuepress-theme-blog__post-layout">
3-
<div class="vuepress-blog-theme-content">
4-
<h1 class="post-title">{{ $frontmatter.title }}</h1>
5-
<PostMeta
6-
:tags="$frontmatter.tags"
7-
:author="$frontmatter.author"
8-
:date="$frontmatter.date"
9-
:location="$frontmatter.location"
10-
/>
11-
<Content />
12-
<Newsletter v-if="$service.email.enabled" />
13-
<hr />
14-
<Comment />
15-
</div>
3+
<article
4+
class="vuepress-blog-theme-content"
5+
itemscope
6+
itemtype="https://schema.org/BlogPosting"
7+
>
8+
<header>
9+
<h1 class="post-title" itemprop="name headline">
10+
{{ $frontmatter.title }}
11+
</h1>
12+
<PostMeta
13+
:tags="$frontmatter.tags"
14+
:author="$frontmatter.author"
15+
:date="$frontmatter.date"
16+
:location="$frontmatter.location"
17+
/>
18+
</header>
19+
<Content itemprop="articleBody" />
20+
<footer>
21+
<Newsletter v-if="$service.email.enabled" />
22+
<hr />
23+
<Comment />
24+
</footer>
25+
</article>
1626
<Toc />
1727
</div>
1828
</template>

0 commit comments

Comments
 (0)