├── example.env ├── .prettierrc ├── static ├── favicon.ico └── README.md ├── assets ├── fonts │ ├── open-sans-v18-latin-600.woff │ ├── open-sans-v18-latin-600.woff2 │ ├── open-sans-v18-latin-regular.woff │ └── open-sans-v18-latin-regular.woff2 ├── README.md └── css │ └── main.css ├── pages ├── articles │ ├── index.vue │ ├── page │ │ └── _page.vue │ └── _slug.vue ├── README.md ├── index.vue └── tags │ ├── index.vue │ └── _tag.vue ├── components ├── README.md ├── svg │ ├── Coffee.vue │ ├── SingleBack.vue │ ├── SingleFwd.vue │ ├── RSS.vue │ ├── DoubleBack.vue │ ├── Twitter.vue │ ├── DoubleFwd.vue │ └── Github.vue ├── Footer.vue ├── PrevNext.vue ├── Header.vue ├── ArticleList.vue └── Pagination.vue ├── utils ├── getRoutes.js ├── global.js ├── getContent.js └── getSiteMeta.js ├── .editorconfig ├── layouts ├── README.md └── default.vue ├── plugins └── README.md ├── middleware └── README.md ├── .eslintrc.js ├── README.md ├── store └── README.md ├── tailwind.config.js ├── package.json ├── content └── articles │ ├── article-1.md │ ├── article-2.md │ ├── article-3.md │ ├── article-4.md │ ├── article-5.md │ ├── hello.md │ └── kitchen-sink.md ├── .gitignore └── nuxt.config.js /example.env: -------------------------------------------------------------------------------- 1 | BASE_URL=https://www.example.com -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": true 4 | } 5 | -------------------------------------------------------------------------------- /static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/garethredfern/nuxt-basic-blog/HEAD/static/favicon.ico -------------------------------------------------------------------------------- /assets/fonts/open-sans-v18-latin-600.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/garethredfern/nuxt-basic-blog/HEAD/assets/fonts/open-sans-v18-latin-600.woff -------------------------------------------------------------------------------- /assets/fonts/open-sans-v18-latin-600.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/garethredfern/nuxt-basic-blog/HEAD/assets/fonts/open-sans-v18-latin-600.woff2 -------------------------------------------------------------------------------- /assets/fonts/open-sans-v18-latin-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/garethredfern/nuxt-basic-blog/HEAD/assets/fonts/open-sans-v18-latin-regular.woff -------------------------------------------------------------------------------- /assets/fonts/open-sans-v18-latin-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/garethredfern/nuxt-basic-blog/HEAD/assets/fonts/open-sans-v18-latin-regular.woff2 -------------------------------------------------------------------------------- /pages/articles/index.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /utils/getRoutes.js: -------------------------------------------------------------------------------- 1 | export default async () => { 2 | const { $content } = require('@nuxt/content'); 3 | const files = await $content({ deep: true }).only(['path']).fetch(); 4 | 5 | return files.map((file) => (file.path === '/index' ? '/' : file.path)); 6 | }; 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /middleware/README.md: -------------------------------------------------------------------------------- 1 | # MIDDLEWARE 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 middleware. 6 | Middleware let you define custom functions that can be run before rendering either a page or a group of pages. 7 | 8 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing#middleware). 9 | -------------------------------------------------------------------------------- /.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 | }; 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nuxt-basic-blog 2 | 3 | ## Build Setup 4 | 5 | ```bash 6 | # install dependencies 7 | $ npm install 8 | 9 | # serve with hot reload at localhost:3000 10 | $ npm run dev 11 | 12 | # build for production and launch server 13 | $ npm run build 14 | $ npm run start 15 | 16 | # generate static project 17 | $ npm run generate 18 | ``` 19 | 20 | For detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org). 21 | -------------------------------------------------------------------------------- /store/README.md: -------------------------------------------------------------------------------- 1 | # STORE 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 Vuex Store files. 6 | Vuex Store option is implemented in the Nuxt.js framework. 7 | 8 | Creating a file in this directory automatically activates the option in the framework. 9 | 10 | More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store). 11 | -------------------------------------------------------------------------------- /components/svg/Coffee.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 19 | -------------------------------------------------------------------------------- /components/Footer.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 21 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /layouts/default.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 26 | -------------------------------------------------------------------------------- /components/svg/SingleBack.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 21 | -------------------------------------------------------------------------------- /components/svg/SingleFwd.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 21 | -------------------------------------------------------------------------------- /components/svg/RSS.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | -------------------------------------------------------------------------------- /pages/index.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 23 | -------------------------------------------------------------------------------- /components/svg/DoubleBack.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 21 | -------------------------------------------------------------------------------- /utils/global.js: -------------------------------------------------------------------------------- 1 | /* 2 | these are the global variables, make sure to change them for yours 3 | you can add anything you like here, just import this file and 4 | access any variable via object syntax global.yourVarName 5 | */ 6 | export default { 7 | siteUrl: 'https://example.com', 8 | siteName: 'Starter Blog', 9 | author: 'Joe Blogs', 10 | twitterHandle: '@joeblogs', 11 | twitterURL: 'https://twitter.com/garethredfern', 12 | githubURL: 'https://github.com/garethredfern', 13 | siteTitle: 'Add Your Main Site Title Here', 14 | siteDesc: 15 | 'A description for your site here, this will show on the home page.', 16 | mainImage: '', 17 | siteType: 'website', 18 | }; 19 | -------------------------------------------------------------------------------- /components/svg/Twitter.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 19 | -------------------------------------------------------------------------------- /components/svg/DoubleFwd.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 26 | -------------------------------------------------------------------------------- /components/svg/Github.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 19 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | const defaultTheme = require('tailwindcss/defaultTheme'); 2 | /* 3 | ** TailwindCSS Configuration File 4 | ** 5 | ** Docs: https://tailwindcss.com/docs/configuration 6 | ** Default: https://github.com/tailwindcss/tailwindcss/blob/master/stubs/defaultConfig.stub.js 7 | */ 8 | module.exports = { 9 | theme: { 10 | extend: { 11 | fontFamily: { 12 | sans: ['Open Sans', ...defaultTheme.fontFamily.sans], 13 | }, 14 | }, 15 | }, 16 | variants: {}, 17 | plugins: [require('@tailwindcss/ui'), require('@tailwindcss/typography')], 18 | purge: { 19 | // Learn more on https://tailwindcss.com/docs/controlling-file-size/#removing-unused-css 20 | enabled: process.env.NODE_ENV === 'production', 21 | content: [ 22 | 'components/**/*.vue', 23 | 'layouts/**/*.vue', 24 | 'pages/**/*.vue', 25 | 'plugins/**/*.js', 26 | 'nuxt.config.js', 27 | ], 28 | }, 29 | }; 30 | -------------------------------------------------------------------------------- /components/PrevNext.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 42 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nuxt-basic-blog", 3 | "version": "1.0.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "nuxt", 7 | "build": "nuxt build", 8 | "start": "nuxt start", 9 | "generate": "nuxt generate", 10 | "lint:js": "eslint --ext .js,.vue --ignore-path .gitignore .", 11 | "lint": "npm run lint:js" 12 | }, 13 | "dependencies": { 14 | "@nuxt/content": "^1.9.0", 15 | "@nuxtjs/feed": "^2.0.0", 16 | "@nuxtjs/sitemap": "^2.4.0", 17 | "@tailwindcss/typography": "^0.2.0", 18 | "@tailwindcss/ui": "^0.5.0", 19 | "nuxt": "^2.14.5", 20 | "prism-themes": "^1.4.0", 21 | "core-js": "^3.6.5" 22 | }, 23 | "devDependencies": { 24 | "@nuxtjs/eslint-config": "^3.1.0", 25 | "@nuxtjs/eslint-module": "^2.0.0", 26 | "@nuxtjs/tailwindcss": "^3.0.2", 27 | "babel-eslint": "^10.1.0", 28 | "eslint": "^7.8.1", 29 | "eslint-config-prettier": "^6.11.0", 30 | "eslint-plugin-nuxt": "^1.0.0", 31 | "eslint-plugin-prettier": "^3.1.4", 32 | "prettier": "^2.1.1" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /assets/css/main.css: -------------------------------------------------------------------------------- 1 | .page-enter-active, 2 | .page-leave-active { 3 | transition: opacity 0.5s; 4 | } 5 | .page-enter, 6 | .page-leave-to { 7 | opacity: 0; 8 | } 9 | 10 | /* open-sans-regular - latin */ 11 | @font-face { 12 | font-family: 'Open Sans'; 13 | font-style: normal; 14 | font-weight: 400; 15 | src: local('Open Sans Regular'), local('OpenSans-Regular'), 16 | url('../fonts/open-sans-v18-latin-regular.woff2') format('woff2'), 17 | /* Chrome 26+, Opera 23+, Firefox 39+ */ 18 | url('../fonts/open-sans-v18-latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ 19 | } 20 | 21 | /* open-sans-600 - latin */ 22 | @font-face { 23 | font-family: 'Open Sans'; 24 | font-style: normal; 25 | font-weight: 600; 26 | src: local('Open Sans SemiBold'), local('OpenSans-SemiBold'), 27 | url('../fonts/open-sans-v18-latin-600.woff2') format('woff2'), 28 | /* Chrome 26+, Opera 23+, Firefox 39+ */ 29 | url('../fonts/open-sans-v18-latin-600.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */ 30 | } 31 | -------------------------------------------------------------------------------- /content/articles/article-1.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Article One 3 | description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.' 4 | image: 'https://res.cloudinary.com/redfern-web/image/upload/v1599840408/redfern-dev/png/nuxt.png' 5 | tags: ['VueJS', 'Nuxt'] 6 | published: '2020-09-01' 7 | --- 8 | 9 | ## Getting started 10 | 11 | Empower your NuxtJS application with `@nuxtjs/content` module: write in a `content/` directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a **Git-based Headless CMS**. 12 | 13 | ## Writing content 14 | 15 | Learn how to write your `content/`, supporting Markdown, YAML, CSV and JSON: https://content.nuxtjs.org/writing. 16 | 17 | ## Fetching content 18 | 19 | Learn how to fetch your content with `$content`: https://content.nuxtjs.org/fetching. 20 | 21 | ## Displaying content 22 | 23 | Learn how to display your Markdown content with the `` component directly in your template: https://content.nuxtjs.org/displaying. 24 | -------------------------------------------------------------------------------- /content/articles/article-2.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Article Two 3 | description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.' 4 | image: 'https://res.cloudinary.com/redfern-web/image/upload/v1599840408/redfern-dev/png/nuxt.png' 5 | tags: ['VueJS', 'Nuxt'] 6 | published: '2020-09-02' 7 | --- 8 | 9 | ## Getting started 10 | 11 | Empower your NuxtJS application with `@nuxtjs/content` module: write in a `content/` directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a **Git-based Headless CMS**. 12 | 13 | ## Writing content 14 | 15 | Learn how to write your `content/`, supporting Markdown, YAML, CSV and JSON: https://content.nuxtjs.org/writing. 16 | 17 | ## Fetching content 18 | 19 | Learn how to fetch your content with `$content`: https://content.nuxtjs.org/fetching. 20 | 21 | ## Displaying content 22 | 23 | Learn how to display your Markdown content with the `` component directly in your template: https://content.nuxtjs.org/displaying. 24 | -------------------------------------------------------------------------------- /content/articles/article-3.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Article Three 3 | description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.' 4 | image: 'https://res.cloudinary.com/redfern-web/image/upload/v1599840408/redfern-dev/png/nuxt.png' 5 | tags: ['VueJS', 'Nuxt'] 6 | published: '2020-09-03' 7 | --- 8 | 9 | ## Getting started 10 | 11 | Empower your NuxtJS application with `@nuxtjs/content` module: write in a `content/` directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a **Git-based Headless CMS**. 12 | 13 | ## Writing content 14 | 15 | Learn how to write your `content/`, supporting Markdown, YAML, CSV and JSON: https://content.nuxtjs.org/writing. 16 | 17 | ## Fetching content 18 | 19 | Learn how to fetch your content with `$content`: https://content.nuxtjs.org/fetching. 20 | 21 | ## Displaying content 22 | 23 | Learn how to display your Markdown content with the `` component directly in your template: https://content.nuxtjs.org/displaying. 24 | -------------------------------------------------------------------------------- /content/articles/article-4.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Article Four 3 | description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.' 4 | image: 'https://res.cloudinary.com/redfern-web/image/upload/v1599840408/redfern-dev/png/nuxt.png' 5 | tags: ['VueJS', 'Nuxt'] 6 | published: '2020-09-04' 7 | --- 8 | 9 | ## Getting started 10 | 11 | Empower your NuxtJS application with `@nuxtjs/content` module: write in a `content/` directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a **Git-based Headless CMS**. 12 | 13 | ## Writing content 14 | 15 | Learn how to write your `content/`, supporting Markdown, YAML, CSV and JSON: https://content.nuxtjs.org/writing. 16 | 17 | ## Fetching content 18 | 19 | Learn how to fetch your content with `$content`: https://content.nuxtjs.org/fetching. 20 | 21 | ## Displaying content 22 | 23 | Learn how to display your Markdown content with the `` component directly in your template: https://content.nuxtjs.org/displaying. 24 | -------------------------------------------------------------------------------- /content/articles/article-5.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Article Five 3 | description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.' 4 | image: 'https://res.cloudinary.com/redfern-web/image/upload/v1599840408/redfern-dev/png/nuxt.png' 5 | tags: ['VueJS', 'Nuxt'] 6 | published: '2020-09-05' 7 | --- 8 | 9 | ## Getting started 10 | 11 | Empower your NuxtJS application with `@nuxtjs/content` module: write in a `content/` directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a **Git-based Headless CMS**. 12 | 13 | ## Writing content 14 | 15 | Learn how to write your `content/`, supporting Markdown, YAML, CSV and JSON: https://content.nuxtjs.org/writing. 16 | 17 | ## Fetching content 18 | 19 | Learn how to fetch your content with `$content`: https://content.nuxtjs.org/fetching. 20 | 21 | ## Displaying content 22 | 23 | Learn how to display your Markdown content with the `` component directly in your template: https://content.nuxtjs.org/displaying. 24 | -------------------------------------------------------------------------------- /content/articles/hello.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Getting started 3 | description: 'Empower your NuxtJS application with @nuxt/content module: write in a content/ directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a Git-based Headless CMS.' 4 | image: 'https://res.cloudinary.com/redfern-web/image/upload/v1599840408/redfern-dev/png/nuxt.png' 5 | tags: ['VueJS', 'Nuxt'] 6 | published: '2020-08-01' 7 | --- 8 | 9 | ## Getting started 10 | 11 | Empower your NuxtJS application with `@nuxtjs/content` module: write in a `content/` directory and fetch your Markdown, JSON, YAML and CSV files through a MongoDB like API, acting as a **Git-based Headless CMS**. 12 | 13 | ## Writing content 14 | 15 | Learn how to write your `content/`, supporting Markdown, YAML, CSV and JSON: https://content.nuxtjs.org/writing. 16 | 17 | ## Fetching content 18 | 19 | Learn how to fetch your content with `$content`: https://content.nuxtjs.org/fetching. 20 | 21 | ## Displaying content 22 | 23 | Learn how to display your Markdown content with the `` component directly in your template: https://content.nuxtjs.org/displaying. 24 | -------------------------------------------------------------------------------- /components/Header.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 38 | -------------------------------------------------------------------------------- /pages/articles/page/_page.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 44 | -------------------------------------------------------------------------------- /utils/getContent.js: -------------------------------------------------------------------------------- 1 | export default async ($content, params, error) => { 2 | const currentPage = parseInt(params.page); 3 | 4 | // Set how many articles to show per page 5 | const perPage = 5; 6 | 7 | const allArticles = await $content('articles').fetch(); 8 | 9 | const totalArticles = allArticles.length; 10 | 11 | // use Math.ceil to round up to the nearest whole number 12 | const lastPage = Math.ceil(totalArticles / perPage); 13 | 14 | // use the % (modulus) operator to get a whole remainder 15 | const lastPageCount = totalArticles % perPage === 0 ? perPage : totalArticles % perPage; 16 | 17 | const skipNumber = () => { 18 | if (currentPage === 1) { 19 | return 0; 20 | } 21 | if (currentPage === lastPage) { 22 | return totalArticles - lastPageCount; 23 | } 24 | return (currentPage - 1) * perPage; 25 | }; 26 | 27 | const paginatedArticles = await $content('articles') 28 | .only(['title', 'description', 'image', 'slug', 'published']) 29 | .sortBy('published', 'desc') 30 | .limit(perPage) 31 | .skip(skipNumber()) 32 | .fetch(); 33 | 34 | if (currentPage === 0 || !paginatedArticles.length) { 35 | return error({ statusCode: 404, message: 'No articles found!' }); 36 | } 37 | 38 | return { 39 | allArticles, 40 | paginatedArticles, 41 | }; 42 | }; 43 | -------------------------------------------------------------------------------- /pages/tags/index.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 49 | -------------------------------------------------------------------------------- /pages/tags/_tag.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 54 | -------------------------------------------------------------------------------- /components/ArticleList.vue: -------------------------------------------------------------------------------- 1 | 36 | 37 | 57 | -------------------------------------------------------------------------------- /utils/getSiteMeta.js: -------------------------------------------------------------------------------- 1 | import global from './global'; 2 | 3 | export default (meta) => { 4 | return [ 5 | { 6 | hid: 'description', 7 | name: 'description', 8 | content: (meta && meta.description) || global.siteDesc, 9 | }, 10 | { 11 | hid: 'og:type', 12 | property: 'og:type', 13 | content: (meta && meta.type) || global.siteType, 14 | }, 15 | { 16 | hid: 'og:url', 17 | property: 'og:url', 18 | content: (meta && meta.url) || global.siteUrl, 19 | }, 20 | { 21 | hid: 'og:title', 22 | property: 'og:title', 23 | content: (meta && meta.title) || global.siteTitle, 24 | }, 25 | { 26 | hid: 'og:description', 27 | property: 'og:description', 28 | content: (meta && meta.description) || global.siteDesc, 29 | }, 30 | { 31 | hid: 'og:image', 32 | property: 'og:image', 33 | content: (meta && meta.mainImage) || global.mainImage, 34 | }, 35 | { 36 | hid: 'twitter:url', 37 | name: 'twitter:url', 38 | content: (meta && meta.url) || global.siteUrl, 39 | }, 40 | { 41 | hid: 'twitter:title', 42 | name: 'twitter:title', 43 | content: (meta && meta.title) || global.siteTitle, 44 | }, 45 | { 46 | hid: 'twitter:description', 47 | name: 'twitter:description', 48 | content: (meta && meta.description) || global.siteDesc, 49 | }, 50 | { 51 | hid: 'twitter:image', 52 | name: 'twitter:image', 53 | content: (meta && meta.mainImage) || global.mainImage, 54 | }, 55 | ]; 56 | }; 57 | -------------------------------------------------------------------------------- /.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 | 83 | # Service worker 84 | sw.* 85 | 86 | # macOS 87 | .DS_Store 88 | 89 | # Vim swap files 90 | *.swp 91 | -------------------------------------------------------------------------------- /content/articles/kitchen-sink.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Kitchen Sink 3 | description: "This is the kitchen sink, all the common markdown elements laid out for you to add styling, really helpful to make sure you don't miss any styles." 4 | image: 'https://res.cloudinary.com/redfern-web/image/upload/v1599840408/redfern-dev/png/nuxt.png' 5 | tags: ['VueJS', 'Nuxt'] 6 | published: '2020-08-02' 7 | --- 8 | 9 | # Heading Level 1 10 | 11 | ## Heading Level 2 12 | 13 | ### Heading Level 3 14 | 15 | #### Heading Level 4 16 | 17 | ##### Heading Level 5 18 | 19 | ###### Heading Level 6 20 | 21 | ### A Paragraph 22 | 23 | This is a paragraph of text which has all the most common html elements in it such as the **strong element** which is used to give text strong importance. You could of course use the b element which represents a span of text stylistically different from normal text, without conveying any special importance or relevance. The mark element which represents highlighted text, i.e., a run of text marked for reference purposes. _The HTML em element marks text that has stress emphasis._ You could of course use the i element which represents a range of text that is set off from the normal text for some reason, for example, technical terms, foreign language phrases, or fictional character thoughts. It is typically displayed in italic type. The next piece of text is marked up using the code element `function()` and finally links will be styled [like this](https://developer.mozilla.org/en-US/docs/HTML/Element/a). 24 | 25 | ### An Ordered list 26 | 27 | 1. List item one 28 | 2. List item two 29 | 3. List item three 30 | 31 | ### A Definition List 32 | 33 |
34 |
Firefox
35 |
A free, open source, cross-platform, graphical web browser 36 | developed by the Mozilla Corporation and hundreds of volunteer 37 |
38 |
39 | 40 | ### A Blockquote 41 | 42 | > Design is the fundamental soul of a human-made creation that ends 43 | > up expressing itself in successive outer layers of the product or 44 | > service. 45 | 46 | ### An Unordered list 47 | 48 | - List item one 49 | - List item two 50 | - List item three 51 | 52 | ### A Code Block 53 | 54 | ```css 55 | header h1 a { 56 | display: block; 57 | width: 300px; 58 | height: 80px; 59 | } 60 | ``` 61 | 62 | This wraps your code in a `pre` tags and `code` tags. 63 | 64 | ### A Table 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 |
Heading (th)Heading (th)Heading (th)Heading (th)
datadatadatadata
datadatadatadata
datadatadatadata
96 | -------------------------------------------------------------------------------- /pages/articles/_slug.vue: -------------------------------------------------------------------------------- 1 | 32 | 33 | 102 | -------------------------------------------------------------------------------- /components/Pagination.vue: -------------------------------------------------------------------------------- 1 | 60 | 61 | 109 | -------------------------------------------------------------------------------- /nuxt.config.js: -------------------------------------------------------------------------------- 1 | import global from './utils/global'; 2 | import getRoutes from './utils/getRoutes'; 3 | import getSiteMeta from './utils/getSiteMeta'; 4 | 5 | const meta = getSiteMeta(); 6 | 7 | export default { 8 | // Target (https://go.nuxtjs.dev/config-target) 9 | target: 'static', 10 | 11 | // Global page headers (https://go.nuxtjs.dev/config-head) 12 | head: { 13 | htmlAttrs: { 14 | lang: 'en-GB', 15 | class: 'bg-black', 16 | }, 17 | title: 'Nuxt Basic Blog', 18 | meta: [ 19 | ...meta, 20 | { charset: 'utf-8' }, 21 | { name: 'viewport', content: 'width=device-width, initial-scale=1' }, 22 | { 23 | hid: 'description', 24 | name: 'description', 25 | content: global.siteDesc || '', 26 | }, 27 | { property: 'og:site_name', content: global.siteName || '' }, 28 | { 29 | hid: 'description', 30 | name: 'description', 31 | content: global.siteDesc || '', 32 | }, 33 | { property: 'og:image:width', content: '740' }, 34 | { property: 'og:image:height', content: '300' }, 35 | { name: 'twitter:site', content: global.siteName || '' }, 36 | { name: 'twitter:card', content: 'summary_large_image' }, 37 | ], 38 | link: [ 39 | { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }, 40 | { 41 | hid: 'canonical', 42 | rel: 'canonical', 43 | href: global.siteUrl, 44 | }, 45 | ], 46 | }, 47 | 48 | // Global CSS (https://go.nuxtjs.dev/config-css) 49 | css: ['~/assets/css/main.css'], 50 | 51 | // Plugins to run before rendering page (https://go.nuxtjs.dev/config-plugins) 52 | plugins: [], 53 | 54 | // Auto import components (https://go.nuxtjs.dev/config-components) 55 | components: true, 56 | 57 | // Modules for dev and build (recommended) (https://go.nuxtjs.dev/config-modules) 58 | buildModules: [ 59 | // https://go.nuxtjs.dev/eslint 60 | '@nuxtjs/eslint-module', 61 | // https://go.nuxtjs.dev/tailwindcss 62 | '@nuxtjs/tailwindcss', 63 | ], 64 | 65 | // Modules (https://go.nuxtjs.dev/config-modules) 66 | modules: [ 67 | // https://go.nuxtjs.dev/content 68 | '@nuxt/content', 69 | '@nuxtjs/feed', 70 | '@nuxtjs/sitemap', 71 | ], 72 | 73 | // Content module configuration (https://go.nuxtjs.dev/content-config) 74 | content: { 75 | markdown: { 76 | prism: { 77 | theme: 'prism-themes/themes/prism-material-oceanic.css', 78 | }, 79 | }, 80 | }, 81 | 82 | // Build Configuration (https://go.nuxtjs.dev/config-build) 83 | build: {}, 84 | 85 | // Sitemap Configuration (https://github.com/nuxt-community/sitemap-module) 86 | sitemap: { 87 | hostname: global.siteUrl, 88 | routes() { 89 | return getRoutes(); 90 | }, 91 | }, 92 | 93 | // RSS Feed Configuration (https://github.com/nuxt-community/feed-module) 94 | feed() { 95 | const baseUrlArticles = `${global.siteUrl}/articles`; 96 | const baseLinkFeedArticles = '/articles'; 97 | const feedFormats = { 98 | rss: { type: 'rss2', file: 'rss.xml' }, 99 | json: { type: 'json1', file: 'feed.json' }, 100 | }; 101 | const { $content } = require('@nuxt/content'); 102 | 103 | const createFeedArticles = async function (feed) { 104 | feed.options = { 105 | title: global.siteName || '', 106 | description: global.siteDesc || '', 107 | link: baseUrlArticles, 108 | }; 109 | const articles = await $content('articles').fetch(); 110 | 111 | articles.forEach((article) => { 112 | const url = `${baseUrlArticles}/${article.slug}`; 113 | 114 | feed.addItem({ 115 | title: article.title, 116 | id: url, 117 | link: url, 118 | date: new Date(article.published), 119 | description: article.description, 120 | content: article.description, 121 | author: global.twitterHandle, 122 | }); 123 | }); 124 | }; 125 | 126 | return Object.values(feedFormats).map(({ file, type }) => ({ 127 | path: `${baseLinkFeedArticles}/${file}`, 128 | type, 129 | create: createFeedArticles, 130 | })); 131 | }, 132 | 133 | publicRuntimeConfig: { 134 | baseUrl: process.env.BASE_URL || 'http://localhost:3000', 135 | }, 136 | }; 137 | --------------------------------------------------------------------------------