File tree 6 files changed +55
-49
lines changed
6 files changed +55
-49
lines changed Original file line number Diff line number Diff line change 2
2
home : true
3
3
heroImage : /hero.png
4
4
actionText : Get Started →
5
- actionLink : /guide/
5
+ actionLink : https://github.com
6
6
features :
7
7
- title : Simplicity First
8
8
details : Minimal setup with markdown-centered project structure helps you focus on writing.
Original file line number Diff line number Diff line change 15
15
class =" dropdown-subitem"
16
16
v-for =" childSubItem in subItem.items"
17
17
:key =" childSubItem.link" >
18
- <nav-link :item =" childSubItem" ></ nav-link >
18
+ <NavLink :item =" childSubItem" / >
19
19
</li >
20
20
</ul >
21
- <nav-link v-else :item =" subItem" ></ nav-link >
21
+ <NavLink v-else :item =" subItem" / >
22
22
</li >
23
23
</ul >
24
24
</div >
25
25
</template >
26
26
27
27
<script >
28
- import { isExternal , ensureExt } from ' ./util'
29
- import NavLink from ' ./NavLink.vue'
28
+ import { isExternal , ensureExt } from ' ./util'
29
+ import NavLink from ' ./NavLink.vue'
30
30
31
- export default {
32
- components: { NavLink },
33
- data () {
34
- return {
35
- open: false
36
- }
37
- },
38
- props: {
39
- item: {
40
- required: true
41
- }
42
- },
43
- methods: {
44
- toggle () {
45
- this .open = ! this .open
46
- }
31
+ export default {
32
+ components: { NavLink },
33
+ data () {
34
+ return {
35
+ open: false
36
+ }
37
+ },
38
+ props: {
39
+ item: {
40
+ required: true
41
+ }
42
+ },
43
+ methods: {
44
+ toggle () {
45
+ this .open = ! this .open
47
46
}
48
47
}
48
+ }
49
49
</script >
50
50
51
51
<style lang="stylus">
Original file line number Diff line number Diff line change 7
7
{{ data.tagline || $site.description }}
8
8
</p >
9
9
<p class =" action" v-if =" data.actionText && data.actionLink" >
10
- <router-link class =" action-button" :to =" ensureExt(data.actionLink)" >
11
- {{ data.actionText }}
12
- </router-link >
10
+ <NavLink class =" action-button" :item =" actionLink" />
13
11
</p >
14
12
</div >
15
13
<div class =" features" >
26
24
</template >
27
25
28
26
<script >
29
- import { ensureExt } from ' ./util '
27
+ import NavLink from ' ./NavLink.vue '
30
28
31
29
export default {
32
- methods: {
33
- ensureExt
34
- },
30
+ components: { NavLink },
35
31
computed: {
36
32
data () {
37
33
return this .$page .frontmatter
34
+ },
35
+ actionLink () {
36
+ return {
37
+ link: this .data .actionLink ,
38
+ text: this .data .actionText
39
+ }
38
40
}
39
41
}
40
42
}
Original file line number Diff line number Diff line change 8
8
<a
9
9
v-else
10
10
:href =" link"
11
- target =" _blank"
12
11
class =" nav-link"
13
- rel =" noopener noreferrer"
12
+ :target =" isMailto(link) ? null : '_blank'"
13
+ :rel =" isMailto(link) ? null : 'noopener noreferrer'"
14
14
>{{ item.text }}</a >
15
15
</template >
16
16
17
17
<script >
18
- import { isExternal , ensureExt } from ' ./util'
19
- export default {
20
- props: {
21
- item: {
22
- required: true
23
- }
24
- },
25
- computed: {
26
- link () {
27
- return ensureExt (this .item .link )
28
- }
29
- },
30
- methods: {
31
- isExternal
18
+ import { isExternal , isMailto , ensureExt } from ' ./util'
19
+
20
+ export default {
21
+ props: {
22
+ item: {
23
+ required: true
24
+ }
25
+ },
26
+ computed: {
27
+ link () {
28
+ return ensureExt (this .item .link )
32
29
}
30
+ },
31
+ methods: {
32
+ isExternal,
33
+ isMailto
33
34
}
35
+ }
34
36
</script >
Original file line number Diff line number Diff line change 5
5
class =" nav-item"
6
6
v-for =" item in userLinks"
7
7
:key =" item.link" >
8
- <dropdown-link
9
- v-if =" item.type === 'links'"
10
- :item =" item" ></dropdown-link >
11
- <nav-link v-else :item =" item" ></nav-link >
8
+ <DropdownLink v-if =" item.type === 'links'" :item =" item" />
9
+ <NavLink v-else :item =" item" />
12
10
</div >
13
11
<!-- github link -->
14
12
<a v-if =" githubLink"
Original file line number Diff line number Diff line change 1
1
export const hashRE = / # .* $ /
2
2
export const extRE = / \. ( m d | h t m l ) $ /
3
3
export const endingSlashRE = / \/ $ /
4
- export const outboundRE = / ^ h t t p s ? : /
4
+ export const outboundRE = / ^ ( h t t p s ? : | m a i l t o : ) /
5
5
6
6
export function normalize ( path ) {
7
7
return path
@@ -20,6 +20,10 @@ export function isExternal (path) {
20
20
return outboundRE . test ( path )
21
21
}
22
22
23
+ export function isMailto ( path ) {
24
+ return / ^ m a i l t o : / . test ( path )
25
+ }
26
+
23
27
export function ensureExt ( path ) {
24
28
if ( isExternal ( path ) ) {
25
29
return path
You can’t perform that action at this time.
0 commit comments