├── .eslintrc.js ├── .gitignore ├── .node-version ├── .prettierrc ├── .vscode ├── extensions.json └── settings.json ├── LICENSE ├── README.md ├── assets ├── README.md └── styles │ ├── colors.css │ └── reset.css ├── components ├── Alert.vue ├── Banner.vue ├── Breadcrumb.vue ├── Card.vue ├── Categories.vue ├── ConversionPoint.vue ├── Footer.vue ├── Header.vue ├── Latest.vue ├── Logo.vue ├── Meta.vue ├── NextBlogNavigation.vue ├── Pagination.vue ├── Partner.vue ├── PopularArticles.vue ├── Post.vue ├── README.md ├── RelatedBlogs.vue ├── Search.vue ├── Share.vue ├── ShareButtons.vue ├── Tags.vue ├── Toc.vue └── Writer.vue ├── functions ├── draft.js └── search.js ├── layouts ├── README.md └── default.vue ├── netlify.toml ├── nuxt.config.js ├── package-lock.json ├── package.json ├── pages ├── 404.vue ├── README.md ├── _slug │ └── index.vue ├── author │ └── _authorId.vue ├── draft │ └── index.vue ├── index.vue └── search │ └── index.vue ├── plugins ├── README.md └── vue-scrollto.js ├── static ├── README.md ├── favicon.png ├── icon.png └── images │ ├── banner_logo.svg │ ├── bg_microcms_screen_black.jpg │ ├── bg_microcms_screen_black.png │ ├── icon_alert.svg │ ├── icon_arrow_bottom.svg │ ├── icon_arrow_left.svg │ ├── icon_arrow_right.svg │ ├── icon_author.svg │ ├── icon_clock.svg │ ├── icon_discord.svg │ ├── icon_facebook.svg │ ├── icon_feed.svg │ ├── icon_github.svg │ ├── icon_hatena.svg │ ├── icon_link.svg │ ├── icon_loading.svg │ ├── icon_menu.svg │ ├── icon_quote.svg │ ├── icon_search.svg │ ├── icon_tag.svg │ ├── icon_tag_navy.svg │ ├── icon_update.svg │ ├── icon_x.svg │ ├── logo.svg │ └── ogp.png └── utils ├── getDefaultOgimage.js └── microcms.js /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | browser: true, 5 | node: true, 6 | }, 7 | parserOptions: { 8 | parser: 'babel-eslint', 9 | }, 10 | extends: [ 11 | '@nuxtjs', 12 | 'prettier', 13 | 'prettier/vue', 14 | 'plugin:prettier/recommended', 15 | 'plugin:nuxt/recommended', 16 | ], 17 | plugins: ['prettier'], 18 | // add your custom rules here 19 | rules: { 20 | 'vue/no-v-html': 'off', 21 | }, 22 | }; 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Node template 3 | # Logs 4 | logs 5 | *.log 6 | npm-debug.log* 7 | yarn-debug.log* 8 | yarn-error.log* 9 | 10 | # Runtime data 11 | pids 12 | *.pid 13 | *.seed 14 | *.pid.lock 15 | 16 | # Directory for instrumented libs generated by jscoverage/JSCover 17 | lib-cov 18 | 19 | # Coverage directory used by tools like istanbul 20 | coverage 21 | 22 | # nyc test coverage 23 | .nyc_output 24 | 25 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 26 | .grunt 27 | 28 | # Bower dependency directory (https://bower.io/) 29 | bower_components 30 | 31 | # node-waf configuration 32 | .lock-wscript 33 | 34 | # Compiled binary addons (https://nodejs.org/api/addons.html) 35 | build/Release 36 | 37 | # Dependency directories 38 | node_modules/ 39 | jspm_packages/ 40 | 41 | # TypeScript v1 declaration files 42 | typings/ 43 | 44 | # Optional npm cache directory 45 | .npm 46 | 47 | # Optional eslint cache 48 | .eslintcache 49 | 50 | # Optional REPL history 51 | .node_repl_history 52 | 53 | # Output of 'npm pack' 54 | *.tgz 55 | 56 | # Yarn Integrity file 57 | .yarn-integrity 58 | 59 | # dotenv environment variables file 60 | .env 61 | 62 | # parcel-bundler cache (https://parceljs.org/) 63 | .cache 64 | 65 | # next.js build output 66 | .next 67 | 68 | # nuxt.js build output 69 | .nuxt 70 | 71 | # Nuxt generate 72 | dist 73 | 74 | # vuepress build output 75 | .vuepress/dist 76 | 77 | # Serverless directories 78 | .serverless 79 | 80 | # IDE / Editor 81 | .idea 82 | .editorconfig 83 | 84 | # Service worker 85 | sw.* 86 | 87 | # Mac OSX 88 | .DS_Store 89 | 90 | # Vim swap files 91 | *.swp 92 | 93 | #amplify 94 | amplify/\#current-cloud-backend 95 | amplify/.config/local-* 96 | amplify/backend/amplify-meta.json 97 | amplify/backend/awscloudformation 98 | build/ 99 | dist/ 100 | node_modules/ 101 | aws-exports.js 102 | awsconfiguration.json 103 | 104 | #rss 105 | feed.xml 106 | feed_update.xml 107 | feed_usecase.xml 108 | 109 | #pwa 110 | sw.* -------------------------------------------------------------------------------- /.node-version: -------------------------------------------------------------------------------- 1 | v16.20.0 -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": true 4 | } 5 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "dbaeumer.vscode-eslint", 4 | "simonsiefke.prettier-vscode" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.codeActionsOnSave": { 3 | "source.fixAll.eslint": true 4 | }, 5 | "editor.formatOnSave": true 6 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # microcms-blog 2 | サイト: https://blog.microcms.io 3 | 4 | ## 機能 5 | - 記事一覧 6 | - カテゴリー別記事一覧 7 | - タグ別記事一覧 8 | - 人気の記事一覧 9 | - 最新の記事一覧 10 | - 著者別の記事一覧 11 | - 検索 12 | - パンくずリスト 13 | - 記事詳細 14 | - 目次 15 | - 著者 16 | - SNSシェアボタン 17 | - 下書きプレビュー 18 | - 関連記事 19 | - サイトマップ 20 | - バナー 21 | - Google Tag Manager 22 | - Facebook Pixel 23 | - RSS 24 | - PWA 25 | 26 | ## 技術構成 27 | - Nuxt(SSG) 28 | - microCMS(コンテンツ) 29 | - Netlify(Hosting, Functions) 30 | - ESLint 31 | - Prettier 32 | - PostCSS 33 | - PWA 34 | 35 | ## microCMSのAPIスキーマ設定 36 | ### ブログ 37 | endpoint: blog 38 | type: リスト形式 39 | 40 | | フィールド ID | 表示名 | 種類 | 41 | | ------------- | ---------- | --------------------------- | 42 | | title | タイトル | テキストフィールド | 43 | | category | カテゴリー | コンテンツ参照 - カテゴリー | 44 | | tag | タグ | 複数コンテンツ参照 - タグ | 45 | | toc_visible | 目次 | 真偽値 | 46 | | body | 本文 | リッチエディタ | 47 | | description | 概要 | テキストフィールド | 48 | | ogimage | OGP 画像 | 画像 | 49 | | writer | 著者 | コンテンツ参照 - 著者 | 50 | | partner | パートナー | コンテンツ参照 - パートナー | 51 | | previous_blog | 前の記事 | コンテンツ参照 - ブログ | 52 | | next_blog | 次の記事 | コンテンツ参照 - ブログ | 53 | | related_blogs | 関連記事 | 複数コンテンツ参照 - ブログ | 54 | | cv_point | CVポイント | 繰り返し(※上限1に設定) - カスタムフィールド | 55 | 56 | #### カスタムフィールド 57 | フィールドID: thumbnail 58 | 59 | | フィールド ID | 表示名 | 種類 | 60 | | ------------- | ---------- | --------------------------- | 61 | | title | タイトル | テキストフィールド | 62 | | text | 本文 | テキストエリア | 63 | | buttonText | ボタンテキスト | テキストフィールド | 64 | | buttonLink | ボタンリンク | テキストフィールド | 65 | | thumbnail | サムネイル | 画像 | 66 | 67 | 68 | ### 著者 69 | endpoint: authors 70 | type: リスト形式 71 | 72 | | フィールドID | 表示名 | 種類 | 73 | | ------------- | ------------- | ----- | 74 | | name | 名前 | テキストフィールド | 75 | | text | 自己紹介 | テキストエリア | 76 | | image | 画像 | 画像 | 77 | | twitter | Twitter URL | テキストフィールド | 78 | | facebook | Facebook URL | テキストフィールド | 79 | | github | GitHub URL | テキストフィールド | 80 | 81 | ### カテゴリー 82 | endpoint: categories 83 | type: リスト形式 84 | 85 | | フィールドID | 表示名 | 種類 | 86 | | ------------- | ------------- | ----- | 87 | | name | 名前 | テキストフィールド | 88 | 89 | ### タグ 90 | endpoint: tags 91 | type: リスト形式 92 | 93 | | フィールド ID | 表示名 | 種類 | 94 | | ------------- | ------ | ------------------ | 95 | | name | 名前 | テキストフィールド | 96 | 97 | ### パートナー 98 | endpoint: partners 99 | type: リスト形式 100 | 101 | | フィールドID | 表示名 | 種類 | 102 | | ------------- | ------------- | ----- | 103 | | company | 会社名 | テキストフィールド | 104 | | url | 会社URL | テキストフィールド | 105 | | description | 説明文 | テキストエリア | 106 | | logo | ロゴ | 画像 | 107 | 108 | ### 人気の記事 109 | endpoint: popular-articles 110 | type: オブジェクト形式 111 | 112 | | フィールドID | 表示名 | 種類 | 113 | | ------------- | ------------- | ----- | 114 | | articles | 人気の記事 | 複数コンテンツ参照 - ブログ | 115 | 116 | ### バナー 117 | endpoint: banner 118 | type: オブジェクト形式 119 | 120 | | フィールドID | 表示名 | 種類 | 121 | | ------------- | ------------- | ----- | 122 | | image | 画像 | 画像 | 123 | | url | リンク先URL | テキストフィールド | 124 | | alt | 代替テキスト | テキストフィールド | 125 | 126 | ## 環境変数 127 | プロジェクトルートに`.env`ファイルを作成し、以下の項目を設定してください。 128 | - API_KEY(microCMSのAPIキー) 129 | - SERVICE_ID(microCMSのサービスID) 130 | - GTM_ID(Google Tag ManagerのID)※任意 131 | - FB_PIXEL_ID(FacebookピクセルID)※任意 132 | 133 | 例: 134 | ``` 135 | API_KEY=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 136 | SERVICE_ID=your-service-id 137 | GTM_ID=GTM-xxxxxxx 138 | FB_PIXEL_ID=xxxxxxxxxxxxxxxxxx 139 | ``` 140 | 141 | ## 開発方法 142 | 143 | ```bash 144 | # パッケージをインストール 145 | $ npm install 146 | 147 | # 開発サーバーを起動(localhost:3000) 148 | $ npm run dev 149 | 150 | # Netlify Functionsをローカルで起動(localhost:9000) 151 | $ npm run functions:serve 152 | 153 | # アプリケーションを静的生成 154 | $ npm run generate 155 | 156 | # 静的生成したアプリケーションを起動 157 | $ npm start 158 | ``` 159 | 160 | ## ライセンス 161 | Apache License 2.0 162 | -------------------------------------------------------------------------------- /assets/README.md: -------------------------------------------------------------------------------- 1 | # ASSETS 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains your un-compiled assets such as LESS, SASS, or JavaScript. 6 | 7 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#webpacked). 8 | -------------------------------------------------------------------------------- /assets/styles/colors.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --color-text-main: #2b2c30; 3 | --color-text-sub: #616269; 4 | --color-text-off: #999; 5 | --color-text-disabled: #ccc; 6 | --color-text-placeholder: #ccc; 7 | --color-text-link: #2b2c30; 8 | --color-border-dark: #ccc; 9 | --color-border: #ddd; 10 | --color-border-light: #eee; 11 | --color-primary: #563bff; 12 | --color-primary-light: #664bff; 13 | --color-gradient-purple: linear-gradient(to right bottom, #5630af, #3067af); 14 | --color-gradient-purple-light: linear-gradient( 15 | to right bottom, 16 | #7650cf, 17 | #5087cf 18 | ); 19 | --color-gradient-blue: linear-gradient(to right bottom, #adaf30, #30af7f); 20 | --color-purple: #331cbf; 21 | --color-green: #2cc63e; 22 | --color-bluegreen: #30af7f; 23 | --color-gray: #ddd; 24 | --color-gray-light: #eee; 25 | --color-accent: #ff8d27; 26 | --color-accent-light: #ff9d37; 27 | --color-blue: #3067af; 28 | --color-pink: #ff357f; 29 | 30 | --color-bg-purple-lightest: #f8f9fd; 31 | --color-bg-purple-light: #f7f7fc; 32 | --color-bg-purple: #e7e7f3; 33 | --color-bg-purple-dark: #cacae7; 34 | --color-bg-blue: #e5eff9; 35 | 36 | --color-bg-success: #e8fbe8; 37 | --color-bg-error: #ffe9df; 38 | --color-error: #d9534f; 39 | 40 | --color-social-twitter: #1d9bf0; 41 | --color-social-x: #0f1419; 42 | --color-social-facebook: #1877f2; 43 | --color-social-hatena: #00a4de; 44 | } 45 | -------------------------------------------------------------------------------- /assets/styles/reset.css: -------------------------------------------------------------------------------- 1 | /* http://meyerweb.com/eric/tools/css/reset/ 2 | v2.0 | 20110126 3 | License: none (public domain) 4 | */ 5 | 6 | html, body, div, span, applet, object, iframe, 7 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 8 | a, abbr, acronym, address, big, cite, code, 9 | del, dfn, em, img, ins, kbd, q, s, samp, 10 | small, strike, strong, sub, sup, tt, var, 11 | b, u, i, center, 12 | dl, dt, dd, ol, ul, li, 13 | fieldset, form, label, legend, 14 | table, caption, tbody, tfoot, thead, tr, th, td, 15 | article, aside, canvas, details, embed, 16 | figure, figcaption, footer, header, hgroup, 17 | menu, nav, output, ruby, section, summary, 18 | time, mark, audio, video { 19 | margin: 0; 20 | padding: 0; 21 | border: 0; 22 | font-size: 100%; 23 | font: inherit; 24 | vertical-align: baseline; 25 | } 26 | 27 | /* HTML5 display-role reset for older browsers 28 | */ 29 | 30 | article, aside, details, figcaption, figure, 31 | footer, header, hgroup, menu, nav, section { 32 | display: block; 33 | } 34 | 35 | body, input { 36 | line-height: 1.5; 37 | font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", YuGothic, "ヒラギノ角ゴ ProN W3", Hiragino Kaku Gothic ProN, Arial, "メイリオ", Meiryo, sans-serif; 38 | color: #2b2c30; 39 | } 40 | 41 | code { 42 | font-family: Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace; 43 | } 44 | 45 | ol, ul { 46 | list-style: none; 47 | } 48 | 49 | blockquote, q { 50 | quotes: none; 51 | } 52 | 53 | blockquote:before, blockquote:after, 54 | q:before, q:after { 55 | content: ''; 56 | content: none; 57 | } 58 | 59 | a { 60 | color: var(--color-text-link); 61 | text-decoration: none; 62 | } 63 | 64 | table { 65 | border-collapse: collapse; 66 | border-spacing: 0; 67 | } 68 | 69 | input, select, button { 70 | &:focus { 71 | outline: none; 72 | } 73 | } 74 | 75 | :placeholder-shown { 76 | color: var(--color-text-placeholder); 77 | } 78 | 79 | ::-webkit-input-placeholder { 80 | color: var(--color-text-placeholder); 81 | } 82 | 83 | /* Firefox 18- */ 84 | 85 | :-moz-placeholder { 86 | color: var(--color-text-placeholder); 87 | opacity: 1; 88 | } 89 | 90 | /* Firefox 19+ */ 91 | 92 | ::-moz-placeholder { 93 | color: var(--color-text-placeholder); 94 | opacity: 1; 95 | } 96 | 97 | /* IE 10+ */ 98 | 99 | :-ms-input-placeholder { 100 | color: var(--color-text-placeholder); 101 | } 102 | 103 | /* for Responsible */ 104 | 105 | @media (max-width: 1030px) { 106 | .forPC { 107 | display: none; 108 | } 109 | } 110 | 111 | @media (min-width: 1030px) { 112 | .forSP { 113 | display: none; 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /components/Alert.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 23 | 24 | 48 | -------------------------------------------------------------------------------- /components/Banner.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 41 | 42 | 60 | -------------------------------------------------------------------------------- /components/Breadcrumb.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 38 | 39 | 69 | -------------------------------------------------------------------------------- /components/Card.vue: -------------------------------------------------------------------------------- 1 | 63 | 64 | 80 | 81 | 134 | -------------------------------------------------------------------------------- /components/Categories.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 25 | 26 | 109 | -------------------------------------------------------------------------------- /components/ConversionPoint.vue: -------------------------------------------------------------------------------- 1 | 79 | 80 | 120 | 121 | 433 | -------------------------------------------------------------------------------- /components/Header.vue: -------------------------------------------------------------------------------- 1 | 115 | 116 | 285 | 286 | 590 | -------------------------------------------------------------------------------- /components/Latest.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 25 | 26 | 105 | -------------------------------------------------------------------------------- /components/Logo.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 36 | -------------------------------------------------------------------------------- /components/Meta.vue: -------------------------------------------------------------------------------- 1 | 45 | 46 | 92 | 93 | 255 | -------------------------------------------------------------------------------- /components/NextBlogNavigation.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 34 | 35 | 96 | -------------------------------------------------------------------------------- /components/Pagination.vue: -------------------------------------------------------------------------------- 1 | 54 | 55 | 98 | 99 | 149 | -------------------------------------------------------------------------------- /components/Partner.vue: -------------------------------------------------------------------------------- 1 | 40 | 41 | 52 | 53 | 160 | -------------------------------------------------------------------------------- /components/PopularArticles.vue: -------------------------------------------------------------------------------- 1 | 34 | 35 | 46 | 47 | 160 | -------------------------------------------------------------------------------- /components/Post.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 16 | 17 | 251 | -------------------------------------------------------------------------------- /components/README.md: -------------------------------------------------------------------------------- 1 | # COMPONENTS 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | The components directory contains your Vue.js Components. 6 | 7 | _Nuxt.js doesn't supercharge these components._ 8 | -------------------------------------------------------------------------------- /components/RelatedBlogs.vue: -------------------------------------------------------------------------------- 1 | 37 | 38 | 49 | 50 | 160 | -------------------------------------------------------------------------------- /components/Search.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 33 | 34 | 66 | -------------------------------------------------------------------------------- /components/Share.vue: -------------------------------------------------------------------------------- 1 | 31 | 32 | 59 | 60 | 126 | -------------------------------------------------------------------------------- /components/ShareButtons.vue: -------------------------------------------------------------------------------- 1 | 45 | 46 | 73 | 74 | 159 | -------------------------------------------------------------------------------- /components/Tags.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 24 | 25 | 116 | -------------------------------------------------------------------------------- /components/Toc.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 30 | 31 | 69 | -------------------------------------------------------------------------------- /components/Writer.vue: -------------------------------------------------------------------------------- 1 | 30 | 31 | 42 | 43 | 129 | -------------------------------------------------------------------------------- /functions/draft.js: -------------------------------------------------------------------------------- 1 | const { client } = require('../utils/microcms'); 2 | 3 | // eslint-disable-next-line require-await 4 | exports.handler = async (event) => { 5 | const { id, draftKey } = event.queryStringParameters; 6 | if (!id) { 7 | return { 8 | statusCode: 400, 9 | body: JSON.stringify({ 10 | error: 'Missing "id" query parameter', 11 | }), 12 | }; 13 | } 14 | return client 15 | .get({ 16 | endpoint: 'blog', 17 | contentId: id, 18 | queries: { 19 | draftKey, 20 | depth: 2, 21 | }, 22 | }) 23 | .then((data) => { 24 | return { 25 | statusCode: 200, 26 | body: JSON.stringify(data), 27 | }; 28 | }) 29 | .catch((error) => ({ 30 | statusCode: 400, 31 | body: String(error), 32 | })); 33 | }; 34 | -------------------------------------------------------------------------------- /functions/search.js: -------------------------------------------------------------------------------- 1 | const { client } = require('../utils/microcms'); 2 | 3 | // eslint-disable-next-line require-await 4 | exports.handler = async (event) => { 5 | const { q } = event.queryStringParameters; 6 | if (!q) { 7 | return { 8 | statusCode: 400, 9 | body: JSON.stringify({ 10 | error: 'Missing "q" query parameter', 11 | }), 12 | }; 13 | } 14 | return client 15 | .get({ 16 | endpoint: 'blog', 17 | queries: { q }, 18 | }) 19 | .then((data) => { 20 | return { 21 | statusCode: 200, 22 | body: JSON.stringify(data), 23 | }; 24 | }) 25 | .catch((error) => ({ 26 | statusCode: 400, 27 | body: String(error), 28 | })); 29 | }; 30 | -------------------------------------------------------------------------------- /layouts/README.md: -------------------------------------------------------------------------------- 1 | # LAYOUTS 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains your Application Layouts. 6 | 7 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/views#layouts). 8 | -------------------------------------------------------------------------------- /layouts/default.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 10 | -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | functions = "dist/api" 3 | 4 | [[redirects]] 5 | from = "/usecase-cainz/" 6 | to = "https://microcms.io/interviews/cainz" 7 | status = 301 8 | force = true 9 | 10 | [[redirects]] 11 | from = "/usecase-web-creator-box/" 12 | to = "https://microcms.io/interviews/web-creator-box" 13 | status = 301 14 | force = true 15 | 16 | [[redirects]] 17 | from = "/usecase-fuller/" 18 | to = "https://microcms.io/interviews/fuller" 19 | status = 301 20 | force = true 21 | 22 | [[redirects]] 23 | from = "/usecase-dip/" 24 | to = "https://microcms.io/interviews/dip" 25 | status = 301 26 | force = true 27 | 28 | [[redirects]] 29 | from = "/usecase-gree-x/" 30 | to = "https://microcms.io/interviews/gree-x" 31 | status = 301 32 | force = true 33 | 34 | [[redirects]] 35 | from = "/usecase-chunichi/" 36 | to = "https://microcms.io/interviews/chunichi" 37 | status = 301 38 | force = true 39 | 40 | [[redirects]] 41 | from = "/usecase-ymj/" 42 | to = "https://microcms.io/interviews/ymj" 43 | status = 301 44 | force = true 45 | 46 | [[redirects]] 47 | from = "/usecase-kinto/" 48 | to = "https://microcms.io/interviews/kinto" 49 | status = 301 50 | force = true 51 | 52 | [[redirects]] 53 | from = "/usecase-nifty/" 54 | to = "https://microcms.io/interviews/nifty" 55 | status = 301 56 | force = true 57 | 58 | [[redirects]] 59 | from = "/usecase-cerezo/" 60 | to = "https://microcms.io/interviews/cerezo" 61 | status = 301 62 | force = true 63 | 64 | [[redirects]] 65 | from = "/usecase-scrap/" 66 | to = "https://microcms.io/interviews/scrap" 67 | status = 301 68 | force = true 69 | 70 | [[redirects]] 71 | from = "/usecase-freee/" 72 | to = "https://microcms.io/interviews/freee" 73 | status = 301 74 | force = true 75 | 76 | [[redirects]] 77 | from = "/usecase-tokyo-gas/" 78 | to = "https://microcms.io/interviews/tokyo-gas" 79 | status = 301 80 | force = true 81 | 82 | [[redirects]] 83 | from = "/usecase-odx/" 84 | to = "https://microcms.io/interviews/odx" 85 | status = 301 86 | force = true 87 | 88 | [[redirects]] 89 | from = "/usecase-alba/" 90 | to = "https://microcms.io/interviews/alba" 91 | status = 301 92 | force = true 93 | 94 | [[redirects]] 95 | from = "/usecase-otamanabi-no-mori/" 96 | to = "https://microcms.io/interviews/otamanabi-no-mori" 97 | status = 301 98 | force = true 99 | 100 | [[redirects]] 101 | from = "/usecase-elnet/" 102 | to = "https://microcms.io/interviews/elnet" 103 | status = 301 104 | force = true 105 | 106 | [[redirects]] 107 | from = "/usecase-smarthr/" 108 | to = "https://microcms.io/interviews/smarthr" 109 | status = 301 110 | force = true 111 | 112 | [[redirects]] 113 | from = "/usecase-leact/" 114 | to = "https://microcms.io/interviews/leact" 115 | status = 301 116 | force = true 117 | 118 | [[redirects]] 119 | from = "/usecase-dmm/" 120 | to = "https://microcms.io/interviews/dmm" 121 | status = 301 122 | force = true 123 | 124 | [[redirects]] 125 | from = "/usecase-housmart/" 126 | to = "https://microcms.io/interviews/housmart" 127 | status = 301 128 | force = true 129 | 130 | [[redirects]] 131 | from = "/usecase-gvatech/" 132 | to = "https://microcms.io/interviews/gvatech" 133 | status = 301 134 | force = true 135 | 136 | [[redirects]] 137 | from = "/usecase-toridoll/" 138 | to = "https://microcms.io/interviews/toridoll" 139 | status = 301 140 | force = true 141 | 142 | [[redirects]] 143 | from = "/usecase-polimill/" 144 | to = "https://microcms.io/interviews/polimill" 145 | status = 301 146 | force = true 147 | 148 | [[redirects]] 149 | from = "/usecase-reiwatravel/" 150 | to = "https://microcms.io/interviews/reiwatravel" 151 | status = 301 152 | force = true 153 | 154 | [[redirects]] 155 | from = "/usecase-ndc/" 156 | to = "https://microcms.io/interviews/ndc" 157 | status = 301 158 | force = true 159 | 160 | [[redirects]] 161 | from = "/usecase-yamap-store/" 162 | to = "https://microcms.io/interviews/yamap-store" 163 | status = 301 164 | force = true 165 | 166 | [[redirects]] 167 | from = "/usecase-nrinetcom/" 168 | to = "https://microcms.io/interviews/nrinetcom" 169 | status = 301 170 | force = true 171 | 172 | [[redirects]] 173 | from = "/usecase-discoveryjapan/" 174 | to = "https://microcms.io/interviews/discoveryjapan" 175 | status = 301 176 | force = true 177 | 178 | [[redirects]] 179 | from = "/usecase-paconsul/" 180 | to = "https://microcms.io/interviews/paconsul" 181 | status = 301 182 | force = true 183 | 184 | [[redirects]] 185 | from = "/usecase-chikaku/" 186 | to = "https://microcms.io/interviews/chikaku" 187 | status = 301 188 | force = true 189 | 190 | [[redirects]] 191 | from = "/usecase-zozotech/" 192 | to = "https://microcms.io/interviews/zozotech" 193 | status = 301 194 | force = true 195 | 196 | [[redirects]] 197 | from = "/usecase-sgis/" 198 | to = "https://microcms.io/interviews/sgis" 199 | status = 301 200 | force = true 201 | 202 | [[redirects]] 203 | from = "/usecase-monex-am/" 204 | to = "https://microcms.io/interviews/monex-am" 205 | status = 301 206 | force = true 207 | 208 | [[redirects]] 209 | from = "/usecase-dwango/" 210 | to = "https://microcms.io/interviews/dwango" 211 | status = 301 212 | force = true 213 | 214 | [[redirects]] 215 | from = "/usecase-beatfit/" 216 | to = "https://microcms.io/interviews/beatfit" 217 | status = 301 218 | force = true 219 | 220 | [[redirects]] 221 | from = "/usecase-odakyu/" 222 | to = "https://microcms.io/interviews/odakyu" 223 | status = 301 224 | force = true 225 | 226 | [[redirects]] 227 | from = "/usecase-medley/" 228 | to = "https://microcms.io/interviews/medley" 229 | status = 301 230 | force = true 231 | 232 | [[redirects]] 233 | from = "/usecase-port/" 234 | to = "https://microcms.io/interviews/port" 235 | status = 301 236 | force = true 237 | 238 | [[redirects]] 239 | from = "/usecase-acall/" 240 | to = "https://microcms.io/interviews/acall" 241 | status = 301 242 | force = true 243 | 244 | [[redirects]] 245 | from = "/usecase-knockonthedoor/" 246 | to = "https://microcms.io/interviews/knockonthedoor" 247 | status = 301 248 | force = true 249 | 250 | [[redirects]] 251 | from = "/usecase-mediba/" 252 | to = "https://microcms.io/interviews/mediba" 253 | status = 301 254 | force = true 255 | 256 | [[redirects]] 257 | from = "/crowdworks-with-microcms/" 258 | to = "https://microcms.io/interviews/crowdworks-with-microcms" 259 | status = 301 260 | force = true 261 | 262 | [[redirects]] 263 | from = "/usecase-mediano/" 264 | to = "https://microcms.io/interviews/mediano" 265 | status = 301 266 | force = true 267 | 268 | [[redirects]] 269 | from = "/usecase-konicaminolta/" 270 | to = "https://microcms.io/interviews/konicaminolta" 271 | status = 301 272 | force = true 273 | 274 | [[redirects]] 275 | from = "/usecase-rebuild/" 276 | to = "https://microcms.io/interviews/rebuild" 277 | status = 301 278 | force = true 279 | 280 | [[redirects]] 281 | from = "/usecase-interspace/" 282 | to = "https://microcms.io/interviews/interspace" 283 | status = 301 284 | force = true 285 | 286 | [[redirects]] 287 | from = "/microcms-multilingual-site/" 288 | to = "https://help.microcms.io/ja/knowledge/multilingual-site" 289 | status = 301 290 | force = true 291 | 292 | [[redirects]] 293 | from = "/*" 294 | to = "/404.html" 295 | status = 404 296 | -------------------------------------------------------------------------------- /nuxt.config.js: -------------------------------------------------------------------------------- 1 | import { client } from './utils/microcms'; 2 | const { API_KEY, SERVICE_ID, GTM_ID, FB_PIXEL_ID } = process.env; 3 | 4 | export default { 5 | target: 'static', 6 | /* 7 | ** Headers of the page 8 | */ 9 | head: { 10 | htmlAttrs: { 11 | prefix: 'og: http://ogp.me/ns#', 12 | lang: 'ja', 13 | }, 14 | titleTemplate: '%s | microCMSブログ', 15 | meta: [ 16 | { charset: 'utf-8' }, 17 | { name: 'viewport', content: 'width=device-width, initial-scale=1' }, 18 | { 19 | hid: 'description', 20 | name: 'description', 21 | content: 22 | 'microCMSはAPIベースの日本製ヘッドレスCMSです。本ブログはmicroCMSの開発メンバーがmicroCMSの使い方や技術的な内容を発信するブログです。', 23 | }, 24 | { 25 | hid: 'og:site_name', 26 | property: 'og:site_name', 27 | content: 'microCMSブログ', 28 | }, 29 | { hid: 'og:type', property: 'og:type', content: 'website' }, 30 | { 31 | hid: 'og:url', 32 | property: 'og:url', 33 | content: 'https://blog.microcms.io', 34 | }, 35 | { hid: 'og:title', property: 'og:title', content: 'microCMSブログ' }, 36 | { 37 | hid: 'og:description', 38 | property: 'og:description', 39 | content: 40 | 'microCMSはAPIベースの日本製ヘッドレスCMSです。本ブログはmicroCMSの開発メンバーがmicroCMSの使い方や技術的な内容を発信するブログです。', 41 | }, 42 | { 43 | hid: 'og:image', 44 | property: 'og:image', 45 | content: 'https://blog.microcms.io/images/ogp.png', 46 | }, 47 | 48 | { name: 'twitter:card', content: 'summary_large_image' }, 49 | { name: 'twitter:site', content: '@micro_cms' }, 50 | ], 51 | link: [ 52 | { 53 | rel: 'icon', 54 | type: 'image/x-icon', 55 | href: 'https://blog.microcms.io/favicon.png', 56 | }, 57 | { 58 | rel: 'alternate', 59 | type: 'application/atom+xml', 60 | href: 'https://blog.microcms.io/feed.xml', 61 | title: 'Atom', 62 | }, 63 | ], 64 | script: [ 65 | { 66 | src: 67 | 'https://cdnjs.cloudflare.com/ajax/libs/lazysizes/5.2.2/lazysizes.min.js', 68 | async: true, 69 | }, 70 | ], 71 | }, 72 | /* 73 | ** Customize the progress-bar color 74 | */ 75 | loading: { color: '#331cbf' }, 76 | /* 77 | ** Global CSS 78 | */ 79 | css: [ 80 | '@/assets/styles/reset.css', 81 | '@/assets/styles/colors.css', 82 | { 83 | src: '~/node_modules/highlight.js/styles/hybrid.css', 84 | lang: 'css', 85 | }, 86 | ], 87 | /* 88 | ** Plugins to load before mounting the App 89 | */ 90 | plugins: ['~/plugins/vue-scrollto'], 91 | components: true, 92 | buildModules: ['@nuxtjs/eslint-module', '@nuxtjs/pwa'], 93 | /* 94 | ** Nuxt.js modules 95 | */ 96 | modules: [ 97 | ['@nuxtjs/dayjs'], 98 | GTM_ID ? ['@nuxtjs/gtm'] : undefined, 99 | FB_PIXEL_ID 100 | ? [ 101 | 'nuxt-facebook-pixel-module', 102 | { 103 | track: 'PageView', 104 | pixelId: FB_PIXEL_ID, 105 | autoPageView: true, 106 | disabled: false, 107 | }, 108 | ] 109 | : undefined, 110 | ['@nuxtjs/sitemap'], 111 | '@nuxtjs/feed', 112 | '@nuxtjs/proxy', 113 | 'nuxt-microcms-module', 114 | ].filter((v) => v), 115 | dayjs: { 116 | locales: ['ja'], 117 | defaultLocale: 'ja', 118 | }, 119 | gtm: { 120 | id: GTM_ID || undefined, 121 | }, 122 | proxy: ['http://localhost:9000/.netlify'], 123 | pwa: { 124 | workbox: { 125 | offlineAssets: [ 126 | '/images/banner_logo.svg', 127 | '/images/icon_author.svg', 128 | '/images/icon_clock.svg', 129 | '/images/icon_facebook.svg', 130 | '/images/icon_discord.svg', 131 | '/images/icon_feed.svg', 132 | '/images/icon_hatena.svg', 133 | '/images/icon_menu.svg', 134 | '/images/icon_quote.svg', 135 | '/images/icon_search.svg', 136 | '/images/icon_link.svg', 137 | '/images/logo.svg', 138 | ], 139 | runtimeCaching: [ 140 | { 141 | urlPattern: 'https://images.microcms-assets.io/.*', 142 | handler: 'staleWhileRevalidate', 143 | }, 144 | ], 145 | }, 146 | }, 147 | microcms: { 148 | options: { 149 | serviceDomain: SERVICE_ID, 150 | apiKey: API_KEY, 151 | }, 152 | mode: process.env.NODE_ENV === 'production' ? 'server' : 'all', 153 | }, 154 | /* 155 | ** Build configuration 156 | */ 157 | build: { 158 | postcss: { 159 | postcssOptions: { 160 | plugins: { 161 | 'postcss-nested': {}, 162 | }, 163 | }, 164 | }, 165 | extend(config, ctx) { 166 | // Run ESLint on save 167 | if (ctx.isDev && ctx.isClient) { 168 | config.module.rules.push({ 169 | enforce: 'pre', 170 | test: /\.(js|vue)$/, 171 | loader: 'eslint-loader', 172 | exclude: /(node_modules)/, 173 | }); 174 | } 175 | }, 176 | }, 177 | router: { 178 | extendRoutes(routes, resolve) { 179 | routes.push({ 180 | path: '/page/:id', 181 | component: resolve(__dirname, 'pages/index.vue'), 182 | name: 'pages', 183 | }); 184 | routes.push({ 185 | path: '/category/:categoryId/page/:id', 186 | component: resolve(__dirname, 'pages/index.vue'), 187 | name: 'categories', 188 | }); 189 | routes.push({ 190 | path: '/tag/:tagId/page/:id', 191 | component: resolve(__dirname, 'pages/index.vue'), 192 | name: 'tags', 193 | }); 194 | routes.push({ 195 | path: '/author/:authorId/page/:id', 196 | component: resolve(__dirname, 'pages/author/_authorId.vue'), 197 | name: 'authors', 198 | }); 199 | routes.push({ 200 | path: '*', 201 | component: resolve(__dirname, 'pages/404.vue'), 202 | name: 'custom', 203 | }); 204 | }, 205 | }, 206 | generate: { 207 | interval: 200, 208 | async routes() { 209 | const range = (start, end) => 210 | [...Array(end - start + 1)].map((_, i) => start + i); 211 | const limit = 50; 212 | const popularArticles = ( 213 | await client.get({ 214 | endpoint: 'popular-articles', 215 | }) 216 | ).articles; 217 | const banner = await client.get({ 218 | endpoint: 'banner', 219 | }); 220 | 221 | // 詳細ページ 222 | const getArticles = (offset = 0) => { 223 | return client 224 | .get({ 225 | endpoint: 'blog', 226 | queries: { 227 | offset, 228 | limit, 229 | depth: 2, 230 | }, 231 | }) 232 | .then(async (res) => { 233 | let articles = []; 234 | if (res.totalCount > offset + limit) { 235 | articles = await getArticles(offset + limit); 236 | } 237 | return [ 238 | ...res.contents.map((content) => ({ 239 | route: `/${content.id}`, 240 | payload: { content, popularArticles, banner }, 241 | })), 242 | ...articles, 243 | ]; 244 | }); 245 | }; 246 | const articles = await getArticles(); 247 | 248 | // 一覧ページ 249 | const index = { 250 | route: '/', 251 | payload: { popularArticles, banner }, 252 | }; 253 | 254 | // 一覧のページング 255 | const pages = await client 256 | .get({ 257 | endpoint: 'blog', 258 | queries: { 259 | limit: 0, 260 | }, 261 | }) 262 | .then((res) => 263 | range(1, Math.ceil(res.totalCount / 10)).map((p) => ({ 264 | route: `/page/${p}`, 265 | payload: { popularArticles, banner }, 266 | })) 267 | ); 268 | 269 | // 検索ページ 270 | const search = { 271 | route: '/search', 272 | payload: { popularArticles, banner }, 273 | }; 274 | 275 | const categories = await client 276 | .get({ 277 | endpoint: 'categories', 278 | queries: { 279 | fields: 'id', 280 | }, 281 | }) 282 | .then(({ contents }) => { 283 | return contents.map((content) => content.id); 284 | }); 285 | 286 | // カテゴリーページ 287 | const categoryPages = await Promise.all( 288 | categories.map((category) => 289 | client 290 | .get({ 291 | endpoint: 'blog', 292 | queries: { 293 | limit: 0, 294 | filters: `category[equals]${category}`, 295 | }, 296 | }) 297 | .then((res) => { 298 | return range(1, Math.ceil(res.totalCount / 10)).map((p) => ({ 299 | route: `/category/${category}/page/${p}`, 300 | payload: { popularArticles, banner }, 301 | })); 302 | }) 303 | ) 304 | ); 305 | const flattenCategoryPages = [].concat.apply([], categoryPages); 306 | 307 | const tags = await client 308 | .get({ 309 | endpoint: 'tags', 310 | queries: { 311 | fields: 'id', 312 | limit: 100, 313 | }, 314 | }) 315 | .then(({ contents }) => { 316 | return contents.map((content) => content.id); 317 | }); 318 | 319 | // タグページ 320 | const tagPages = await Promise.all( 321 | tags.map((tag) => 322 | client 323 | .get({ 324 | endpoint: 'blog', 325 | queries: { 326 | limit: 0, 327 | filters: `tag[contains]${tag}`, 328 | }, 329 | }) 330 | .then((res) => { 331 | return range(1, Math.ceil(res.totalCount / 10)).map((p) => ({ 332 | route: `/tag/${tag}/page/${p}`, 333 | payload: { popularArticles, banner }, 334 | })); 335 | }) 336 | ) 337 | ); 338 | const flattenTagPages = [].concat.apply([], tagPages); 339 | 340 | return [ 341 | index, 342 | search, 343 | ...articles, 344 | ...pages, 345 | ...flattenCategoryPages, 346 | ...flattenTagPages, 347 | ]; 348 | }, 349 | dir: 'dist', 350 | }, 351 | sitemap: { 352 | path: '/sitemap.xml', 353 | hostname: 'https://blog.microcms.io', 354 | exclude: ['/draft', '/404'], 355 | gzip: true, 356 | trailingSlash: true, 357 | }, 358 | feed: async () => { 359 | const authors = await client 360 | .get({ 361 | endpoint: 'authors', 362 | queries: { 363 | limit: 100, 364 | }, 365 | }) 366 | .then((res) => res.contents); 367 | const authorsSettings = authors.map((author) => { 368 | return { 369 | path: `/author/${author.id}/feed.xml`, 370 | async create(feed) { 371 | feed.options = { 372 | title: `${author.name}が執筆した記事 | microCMSブログ`, 373 | link: 'https://blog.microcms.io/feed.xml', 374 | description: 375 | 'microCMSはAPIベースの日本製ヘッドレスCMSです。本ブログはmicroCMSの開発メンバーがmicroCMSの使い方や技術的な内容を発信するブログです。', 376 | }; 377 | const posts = await client 378 | .get({ 379 | endpoint: 'blog', 380 | queries: { 381 | filters: `writer[equals]${author.id}`, 382 | }, 383 | }) 384 | .then((res) => res.contents); 385 | posts.forEach((post) => { 386 | feed.addItem({ 387 | title: post.title, 388 | id: post.id, 389 | link: `https://blog.microcms.io/${post.id}/`, 390 | description: post.description, 391 | content: post.description, 392 | date: new Date(post.publishedAt || post.createdAt), 393 | image: post.ogimage && post.ogimage.url, 394 | }); 395 | }); 396 | }, 397 | cacheTime: 1000 * 60 * 15, 398 | type: 'rss2', 399 | }; 400 | }); 401 | return [ 402 | { 403 | path: '/feed.xml', 404 | async create(feed) { 405 | feed.options = { 406 | title: 'microCMSブログ', 407 | link: 'https://blog.microcms.io/feed.xml', 408 | description: 409 | 'microCMSはAPIベースの日本製ヘッドレスCMSです。本ブログはmicroCMSの開発メンバーがmicroCMSの使い方や技術的な内容を発信するブログです。', 410 | }; 411 | 412 | const posts = await client 413 | .get({ 414 | endpoint: 'blog', 415 | }) 416 | .then((res) => res.contents); 417 | 418 | posts.forEach((post) => { 419 | feed.addItem({ 420 | title: post.title, 421 | id: post.id, 422 | link: `https://blog.microcms.io/${post.id}/`, 423 | description: post.description, 424 | content: post.description, 425 | date: new Date(post.publishedAt || post.createdAt), 426 | image: post.ogimage && post.ogimage.url, 427 | }); 428 | }); 429 | }, 430 | cacheTime: 1000 * 60 * 15, 431 | type: 'rss2', 432 | }, 433 | { 434 | path: '/feed_update.xml', 435 | async create(feed) { 436 | feed.options = { 437 | title: '更新情報|microCMSブログ', 438 | link: 'https://blog.microcms.io/feed.xml', 439 | description: 440 | 'microCMSはAPIベースの日本製ヘッドレスCMSです。本ブログはmicroCMSの開発メンバーがmicroCMSの使い方や技術的な内容を発信するブログです。', 441 | }; 442 | 443 | const posts = await client 444 | .get({ 445 | endpoint: 'blog', 446 | queries: { 447 | filters: 'category[equals]update', 448 | }, 449 | }) 450 | .then((res) => res.contents); 451 | 452 | posts.forEach((post) => { 453 | feed.addItem({ 454 | title: post.title, 455 | id: post.id, 456 | link: `https://blog.microcms.io/${post.id}/`, 457 | description: post.description, 458 | content: post.description, 459 | date: new Date(post.publishedAt || post.createdAt), 460 | image: post.ogimage && post.ogimage.url, 461 | }); 462 | }); 463 | }, 464 | cacheTime: 1000 * 60 * 15, 465 | type: 'rss2', 466 | }, 467 | { 468 | path: '/feed_usecase.xml', 469 | async create(feed) { 470 | feed.options = { 471 | title: '導入事例|microCMSブログ', 472 | link: 'https://blog.microcms.io/feed.xml', 473 | description: 474 | 'microCMSはAPIベースの日本製ヘッドレスCMSです。本ブログはmicroCMSの開発メンバーがmicroCMSの使い方や技術的な内容を発信するブログです。', 475 | }; 476 | 477 | const posts = await client 478 | .get({ 479 | endpoint: 'blog', 480 | queries: { 481 | filters: 'category[equals]usecase', 482 | }, 483 | }) 484 | .then((res) => res.contents); 485 | 486 | posts.forEach((post) => { 487 | feed.addItem({ 488 | title: post.title, 489 | id: post.id, 490 | link: `https://blog.microcms.io/${post.id}/`, 491 | description: post.description, 492 | content: post.description, 493 | date: new Date(post.publishedAt || post.createdAt), 494 | image: post.ogimage && post.ogimage.url, 495 | }); 496 | }); 497 | }, 498 | cacheTime: 1000 * 60 * 15, 499 | type: 'rss2', 500 | }, 501 | ...authorsSettings, 502 | ]; 503 | }, 504 | }; 505 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "microcms-blog", 3 | "version": "1.0.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "nuxt", 7 | "generate": "nuxt generate --fail-on-error", 8 | "start": "nuxt start", 9 | "lint": "eslint --ext .js,.vue --ignore-path .gitignore .", 10 | "lintfix": "eslint --fix --ext .js,.vue --ignore-path .gitignore .", 11 | "functions:build": "netlify-lambda build functions", 12 | "functions:serve": "netlify-lambda serve functions" 13 | }, 14 | "dependencies": { 15 | "axios": "^0.21.2", 16 | "cheerio": "^1.0.0-rc.3", 17 | "encoding": "^0.1.13", 18 | "highlight.js": "^10.0.0", 19 | "microcms-js-sdk": "^2.0.0", 20 | "nuxt": "^2.17.2", 21 | "nuxt-facebook-pixel-module": "^1.5.0", 22 | "nuxt-microcms-module": "^1.0.1" 23 | }, 24 | "devDependencies": { 25 | "@nuxtjs/dayjs": "^1.1.9", 26 | "@nuxtjs/dotenv": "^1.4.1", 27 | "@nuxtjs/eslint-config": "^3.0.0", 28 | "@nuxtjs/eslint-module": "^2.0.0", 29 | "@nuxtjs/feed": "^1.1.0", 30 | "@nuxtjs/google-analytics": "^2.2.0", 31 | "@nuxtjs/gtm": "^2.4.0", 32 | "@nuxtjs/proxy": "^2.1.0", 33 | "@nuxtjs/pwa": "^3.0.0-beta.20", 34 | "@nuxtjs/sitemap": "^2.4.0", 35 | "babel-eslint": "^10.1.0", 36 | "eslint": "^7.2.0", 37 | "eslint-config-prettier": "^6.11.0", 38 | "eslint-plugin-nuxt": "^1.0.0", 39 | "eslint-plugin-prettier": "^3.1.4", 40 | "netlify-lambda": "^1.6.3", 41 | "postcss-css-variables": "^0.18.0", 42 | "postcss-import": "^12.0.1", 43 | "postcss-nested": "^4.1.2", 44 | "prettier": "^2.0.5", 45 | "vue-scrollto": "^2.17.1" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /pages/404.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 24 | 25 | 49 | -------------------------------------------------------------------------------- /pages/README.md: -------------------------------------------------------------------------------- 1 | # PAGES 2 | 3 | This directory contains your Application Views and Routes. 4 | The framework reads all the `*.vue` files inside this directory and creates the router of your application. 5 | 6 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing). 7 | -------------------------------------------------------------------------------- /pages/author/_authorId.vue: -------------------------------------------------------------------------------- 1 | 101 | 102 | 180 | 181 | 346 | -------------------------------------------------------------------------------- /pages/index.vue: -------------------------------------------------------------------------------- 1 | 70 | 71 | 162 | 163 | 524 | -------------------------------------------------------------------------------- /pages/search/index.vue: -------------------------------------------------------------------------------- 1 | 89 | 90 | 182 | 183 | 575 | -------------------------------------------------------------------------------- /plugins/README.md: -------------------------------------------------------------------------------- 1 | # PLUGINS 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains Javascript plugins that you want to run before mounting the root Vue.js application. 6 | 7 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/plugins). 8 | -------------------------------------------------------------------------------- /plugins/vue-scrollto.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import VueScrollTo from 'vue-scrollto'; 3 | 4 | Vue.use(VueScrollTo); 5 | 6 | export default function vueScrollTo(context, inject) { 7 | inject('scrollTo', VueScrollTo.scrollTo); 8 | } 9 | -------------------------------------------------------------------------------- /static/README.md: -------------------------------------------------------------------------------- 1 | # STATIC 2 | 3 | **This directory is not required, you can delete it if you don't want to use it.** 4 | 5 | This directory contains your static files. 6 | Each file inside this directory is mapped to `/`. 7 | Thus you'd want to delete this README.md before deploying to production. 8 | 9 | Example: `/static/robots.txt` is mapped as `/robots.txt`. 10 | 11 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#static). 12 | -------------------------------------------------------------------------------- /static/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microcmsio/microcms-blog/7177114ac49e8179a1bb130409656f82b2807797/static/favicon.png -------------------------------------------------------------------------------- /static/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microcmsio/microcms-blog/7177114ac49e8179a1bb130409656f82b2807797/static/icon.png -------------------------------------------------------------------------------- /static/images/banner_logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Group 2 5 | Created with Sketch. 6 | 17 | -------------------------------------------------------------------------------- /static/images/bg_microcms_screen_black.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microcmsio/microcms-blog/7177114ac49e8179a1bb130409656f82b2807797/static/images/bg_microcms_screen_black.jpg -------------------------------------------------------------------------------- /static/images/bg_microcms_screen_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microcmsio/microcms-blog/7177114ac49e8179a1bb130409656f82b2807797/static/images/bg_microcms_screen_black.png -------------------------------------------------------------------------------- /static/images/icon_alert.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/images/icon_arrow_bottom.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/images/icon_arrow_left.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/images/icon_arrow_right.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/images/icon_author.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Group 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /static/images/icon_clock.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ic_query_builder_24px 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /static/images/icon_discord.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /static/images/icon_facebook.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Fill 4 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /static/images/icon_feed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | iconfinder_rss_246005 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /static/images/icon_github.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/images/icon_hatena.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | hatenabookmark-logomark 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /static/images/icon_link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Artboard 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /static/images/icon_loading.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /static/images/icon_menu.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | menu 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /static/images/icon_quote.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ic/format_quote 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /static/images/icon_search.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ic_search_24px 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /static/images/icon_tag.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /static/images/icon_tag_navy.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /static/images/icon_update.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/images/icon_x.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/images/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Group 2 5 | Created with Sketch. 6 | 16 | -------------------------------------------------------------------------------- /static/images/ogp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microcmsio/microcms-blog/7177114ac49e8179a1bb130409656f82b2807797/static/images/ogp.png -------------------------------------------------------------------------------- /utils/getDefaultOgimage.js: -------------------------------------------------------------------------------- 1 | export default function getDefaultOgimage(content) { 2 | const encodedTitle = encodeURI(content.title); 3 | const length = content.title.length; 4 | const textSize = length > 36 ? 56 : length > 22 ? 64 : length > 14 ? 74 : 84; // 正確な文字数ではないが大体の指標としては十分と判断する 5 | return `https://images.blog.microcms.io/assets/f5d83e38f9374219900ef1b0cc4d85cd/92c09085ec6243cca78046fa644dd8cd/banner-bg.png?blend-mode=normal&blend-x=78&blend-y=200&blend64=${Buffer.from( 6 | `https://assets.imgix.net/~text?txtsize=${textSize}&w=672&txtfont=Noto%20Sans%20JP%20Black&txt-color=212149&txt=${encodedTitle}`, 7 | 'ascii' 8 | ).toString('base64')}`; 9 | } 10 | -------------------------------------------------------------------------------- /utils/microcms.js: -------------------------------------------------------------------------------- 1 | const { createClient } = require('microcms-js-sdk'); 2 | require('dotenv').config(); 3 | const { API_KEY, SERVICE_ID } = process.env; 4 | export const client = createClient({ 5 | serviceDomain: SERVICE_ID, 6 | apiKey: API_KEY, 7 | }); 8 | --------------------------------------------------------------------------------