Nuxt 目錄結構

Nuxt 目錄結構

assets 資產目錄

static 靜態目錄

nuxt-config.js nuxt 配置文件

pages 頁面目錄

plugins 插件目錄

middleware 中間件

layouts 頁面佈局

node_modules 依賴文件包,

package.json 腳本

基本設置(廣告效果與版面配置)

在static檔案夾新增robots.txt

##robots.txt 文件有許多的規則,可以控制搜尋蜘蛛如何爬取你得網站。
請參閱

1
2
3
4
User-agent: *
Crawl-delay: 30 //延遲30秒的時間
Disallow: / //允許搜尋蜘蛛爬取全部網站
Allow: /

Sitemap: https://xxx.xxx.xxx/sitemap.xml

在static新增landing_page.html

1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html lang=”en”>

<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>頁面</title>
</head>
<body>
<h1>(廣告效果)</h1>
</body>

</html>

在layouts 資料夾:

新增default.vue

1
2
3
<template>
<Nuxt />
</template>

新增 error_layout.vue

1
2
3
4
5
6
7
8
<template>
<div>
<header>
<h1>錯誤頁面</h1>
</header>
<Nuxt />
</div>
</template>

新增 error.vue

1
2
3
4
5
6
7
8
9
10
11
12
<template>
<div>
<h1>Sorry,無此頁面!</h1>
<!– {{error}} –>
</div>
</template>
<script>
export default {
props: [‘error’],
layout: ‘error_layout’ // 不指定錯誤頁面佈局的話,則會使用default默認佈局
}
</script>