Repository: strapi/strapi-starter-nuxt-blog
Branch: master
Commit: f7cf92154a90
Files: 27
Total size: 21.5 KB
Directory structure:
gitextract_1dcvs84i/
├── .gitignore
├── LICENSE.txt
├── README.md
├── starter/
│ ├── .eslintignore
│ ├── .eslintrc
│ ├── assets/
│ │ ├── README.md
│ │ └── css/
│ │ └── main.css
│ ├── components/
│ │ ├── ArticleCard.vue
│ │ ├── Articles.vue
│ │ ├── Logo.vue
│ │ └── README.md
│ ├── layouts/
│ │ ├── README.md
│ │ └── default.vue
│ ├── middleware/
│ │ └── README.md
│ ├── nuxt.config.js
│ ├── package.json
│ ├── pages/
│ │ ├── README.md
│ │ ├── articles/
│ │ │ └── _slug.vue
│ │ ├── categories/
│ │ │ └── _slug.vue
│ │ └── index.vue
│ ├── plugins/
│ │ ├── README.md
│ │ └── uikit.js
│ ├── static/
│ │ └── README.md
│ ├── store/
│ │ └── README.md
│ └── utils/
│ ├── medias.js
│ └── seo.js
└── starter.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
############################
# OS X
############################
.DS_Store
.AppleDouble
.LSOverride
Icon
.Spotlight-V100
.Trashes
._*
############################
# Linux
############################
*~
############################
# Windows
############################
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
*.cab
*.msi
*.msm
*.msp
############################
# Packages
############################
*.7z
*.csv
*.dat
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.com
*.class
*.dll
*.exe
*.o
*.seed
*.so
*.swo
*.swp
*.swn
*.swm
*.out
*.pid
############################
# Logs and databases
############################
.tmp
*.log
*.sql
*.sqlite
*.sqlite3
############################
# Misc.
############################
*#
ssl
.idea
nbproject
public/uploads/*
!public/uploads/.gitkeep
############################
# Node.js
############################
lib-cov
lcov.info
pids
logs
results
node_modules
.node_history
############################
# Tests
############################
testApp
coverage
############################
# Strapi
############################
exports
.cache
build
# Custom
.vscode
dist
.nuxt
.env
================================================
FILE: LICENSE.txt
================================================
MIT License
Copyright (c) [year] [fullname]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
**:no_entry: Deprecated**
This repository is no longer maintained and only works for Strapi v3. To find the newest Strapi v4 starters, check out the [starters-and-templates monorepo](https://github.com/strapi/starters-and-templates/).
---
# Strapi Starter Nuxt Blog
Nuxt starter for creating a blog with Strapi.

This starter allows you to try Strapi with Nuxt with the example of a simple blog. It is fully customizable and due to the fact that it is open source, fully open to contributions. So do not hesitate to add new features and report bugs!
This starter uses the [Strapi blog template](https://github.com/strapi/strapi-template-blog)
Check out all of our starters [here](https://strapi.io/starters)
## Features
- 2 Content types: Article, Category
- 2 Created articles
- 3 Created categories
- Permissions set to `true` for article and category
- Responsive design using UIkit
Pages:
- "/" display every articles
- "/article/:id" display one article
- "/category/:id" display articles depending on the category
## Getting started
Use our `create-strapi-starter` CLI to create your project.
```sh
npx create-strapi-starter@3 my-site nuxt-blog
```
The CLI will create a monorepo, install dependencies, and run your project automatically.
The Nuxt frontend server will run here => [http://localhost:3000](http://localhost:3000)
The Strapi backend server will run here => [http://localhost:1337](http://localhost:1337)
## Deploying to production
You will need to deploy the `frontend` and `backend` projects separately. Here are the docs to deploy each one:
- [Deploy Strapi](https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/deployment.html#hosting-provider-guides)
- [Deploy Nuxt](https://nuxtjs.org/docs/2.x/deployment/deploying-to-21yunbox)
Don't forget to setup the environment variables on your production app:
For the frontend the following environment variable is required:
- `API_URL`: URL of your Strapi backend, without trailing slash
Enjoy this starter!
================================================
FILE: starter/.eslintignore
================================================
.gitignore
node_modules
.vscode
dist
.nuxt
================================================
FILE: starter/.eslintrc
================================================
{
"root": true,
"env": {
"browser": true,
"node": true
},
"parserOptions": {
"parser": "babel-eslint"
},
"extends": [
"eslint:recommended",
"plugin:vue/recommended",
"plugin:prettier/recommended",
"prettier/vue"
],
"plugins": ["vue"],
"rules": {}
}
================================================
FILE: starter/assets/README.md
================================================
# ASSETS
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your un-compiled assets such as LESS, SASS, or JavaScript.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#webpacked).
================================================
FILE: starter/assets/css/main.css
================================================
a {
text-decoration: none;
}
h1 {
font-family: Staatliches;
font-size: 120px;
}
#category {
font-family: Staatliches;
font-weight: 500;
}
#title {
letter-spacing: .4px;
font-size: 22px;
font-size: 1.375rem;
line-height: 1.13636;
}
#banner {
margin: 20px;
height: 800px;
}
#editor {
font-size: 16px;
font-size: 1rem;
line-height: 1.75;
}
.uk-navbar-container {
background: #fff !important;
font-family: Staatliches;
}
img:hover {
opacity: 1;
transition: opacity 0.25s cubic-bezier(0.39, 0.575, 0.565, 1);
}
================================================
FILE: starter/components/ArticleCard.vue
================================================
================================================
FILE: starter/components/README.md
================================================
# COMPONENTS
**This directory is not required, you can delete it if you don't want to use it.**
The components directory contains your Vue.js Components.
_Nuxt.js doesn't supercharge these components._
================================================
FILE: starter/layouts/README.md
================================================
# LAYOUTS
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your Application Layouts.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/views#layouts).
================================================
FILE: starter/layouts/default.vue
================================================
Strapi blog
{{ category.name }}
Built with strapi
================================================
FILE: starter/middleware/README.md
================================================
# MIDDLEWARE
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your application middleware.
Middleware let you define custom functions that can be run before rendering either a page or a group of pages.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing#middleware).
================================================
FILE: starter/nuxt.config.js
================================================
const strapiBaseUri = process.env.API_URL || "http://localhost:1337";
export default {
target: "static",
env: {
strapiBaseUri,
},
head: {
meta: [
{ charset: "utf-8" },
{ name: "viewport", content: "width=device-width, initial-scale=1" },
],
link: [
{
rel: "stylesheet",
href: "https://fonts.googleapis.com/css?family=Staatliches",
},
],
},
/*
** Global CSS
*/
css: [
"uikit/dist/css/uikit.min.css",
"uikit/dist/css/uikit.css",
"@assets/css/main.css",
],
plugins: [{ src: "~/plugins/uikit.js", ssr: false }],
modules: ["@nuxtjs/markdownit", "@nuxtjs/strapi"],
strapi: {
url: strapiBaseUri,
entities: [
{
name: "articles",
type: "collection",
},
{
name: "categories",
type: "collection",
},
{
name: "homepage",
type: "single",
},
{
name: "global",
type: "single",
},
],
},
markdownit: {
preset: "default",
linkify: true,
breaks: true,
injected: true,
html: true,
},
};
================================================
FILE: starter/package.json
================================================
{
"name": "frontend",
"version": "1.0.0",
"description": "My polished Nuxt.js project",
"author": "You",
"private": true,
"scripts": {
"dev": "nuxt",
"develop": "nuxt",
"start": "nuxt start",
"generate": "nuxt generate",
"lint": "eslint --ext .js,.vue .",
"lint:fix": "eslint --ext .js,.vue . --fix"
},
"dependencies": {
"@nuxtjs/markdownit": "^1.2.7",
"@nuxtjs/strapi": "^0.1.6",
"graphql": "^14.5.8",
"moment": "^2.29.0",
"nuxt": "^2.14.6",
"uikit": "^3.2.3"
},
"devDependencies": {
"@babel/runtime-corejs3": "^7.9.6",
"babel-eslint": "^10.1.0",
"core-js": "^3.6.5",
"eslint": "^7.9.0",
"eslint-config-prettier": "^6.11.0",
"eslint-loader": "^4.0.2",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-vue": "^6.2.2",
"prettier": "^2.1.2"
},
"license": "MIT"
}
================================================
FILE: starter/pages/README.md
================================================
# PAGES
This directory contains your Application Views and Routes.
The framework reads all the `*.vue` files inside this directory and creates the router of your application.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing).
================================================
FILE: starter/pages/articles/_slug.vue
================================================
{{ article.title }}
{{ moment(article.published_at).format("MMM Do YY") }}
================================================
FILE: starter/plugins/README.md
================================================
# PLUGINS
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains Javascript plugins that you want to run before mounting the root Vue.js application.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/plugins).
================================================
FILE: starter/plugins/uikit.js
================================================
import Vue from "vue";
import UIkit from "uikit/dist/js/uikit-core";
import Icons from "uikit/dist/js/uikit-icons";
UIkit.use(Icons);
UIkit.container = "#__nuxt";
Vue.prototype.$uikit = UIkit;
================================================
FILE: starter/static/README.md
================================================
# STATIC
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your static files.
Each file inside this directory is mapped to `/`.
Thus you'd want to delete this README.md before deploying to production.
Example: `/static/robots.txt` is mapped as `/robots.txt`.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#static).
================================================
FILE: starter/store/README.md
================================================
# STORE
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your Vuex Store files.
Vuex Store option is implemented in the Nuxt.js framework.
Creating a file in this directory automatically activates the option in the framework.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store).
================================================
FILE: starter/utils/medias.js
================================================
export function getStrapiMedia(url) {
// Check if URL is a local path
if (url.startsWith("/")) {
// Prepend Strapi address
return `${process.env.strapiBaseUri}${url}`;
}
// Otherwise return full URL
return url;
}
================================================
FILE: starter/utils/seo.js
================================================
import { getStrapiMedia } from "./medias";
export function getMetaTags(seo) {
const tags = [];
if (seo.metaTitle) {
tags.push(
{
property: "og:title",
content: seo.metaTitle,
},
{
name: "twitter:title",
content: seo.metaTitle,
}
);
}
if (seo.metaDescription) {
tags.push(
{
name: "description",
content: seo.metaDescription,
},
{
property: "og:description",
content: seo.metaDescription,
},
{
name: "twitter:description",
content: seo.metaDescription,
}
);
}
if (seo.shareImage) {
const imageUrl = getStrapiMedia(seo.shareImage.url);
tags.push(
{
name: "image",
content: imageUrl,
},
{
property: "og:image",
content: imageUrl,
},
{
name: "twitter:image",
content: imageUrl,
}
);
}
if (seo.article) {
tags.push({
property: "og:type",
content: "article",
});
}
tags.push({ name: "twitter:card", content: "summary_large_image" });
return tags;
}
================================================
FILE: starter.json
================================================
{
"template": "https://github.com/strapi/strapi-template-blog"
}