|
| 1 | +--- |
| 2 | +navigation.title: 'Home' |
| 3 | +--- |
| 4 | + |
| 5 | +# Content Wind |
| 6 | + |
| 7 | +A lightweight Nuxt theme to build a Markdown driven website, based on [Nuxt Content](https://content.nuxtjs.org), [TailwindCSS](https://tailwindcss.com) and [Iconify](https://iconify.design) :sparkles: |
| 8 | + |
| 9 | +## Features |
| 10 | + |
| 11 | +::list{icon=ph:check-circle-duotone} |
| 12 | +- Write pages in Markdown |
| 13 | +- Use [layouts](https://nuxt.com/docs/guide/directory-structure/layouts) in Markdown pages |
| 14 | +- Enjoy meta tag generation |
| 15 | +- Configurable [prose components](https://typography.nuxt.space) |
| 16 | +- Generated navigation from pages |
| 17 | +- Switch between light & dark mode |
| 18 | +- Access 100,000 icons from 100+ icon sets |
| 19 | +- Highlight code blocks with [Shiki](https://shiki.matsu.io) |
| 20 | +- Create Vue components and use them in Markdown |
| 21 | +- Deploy on any Node or Static hosting: GH Pages, Vercel, Netlify, Heroku, etc. |
| 22 | +- Live edit on [Nuxt Studio](https://nuxt.studio) |
| 23 | +:: |
| 24 | + |
| 25 | +## Setup |
| 26 | + |
| 27 | +::button-link{icon="simple-icons:stackblitz" href="https://stackblitz.com/edit/nuxt-content-wind?file=content%2F1.index.md" blank} |
| 28 | +Play online on Stackblitz |
| 29 | +:: |
| 30 | + |
| 31 | +Open a terminal and run the following command: |
| 32 | + |
| 33 | +```bash |
| 34 | +npx nuxi init -t themes/content-wind my-website |
| 35 | +``` |
| 36 | + |
| 37 | +Follow the instructions in the terminal and you are ready to go :rocket: |
| 38 | + |
| 39 | +## Usage |
| 40 | + |
| 41 | +This template has some built-in features to make it as easy as possible to create a content-driven website. |
| 42 | + |
| 43 | +### Pages |
| 44 | + |
| 45 | +Create your Markdown pages in the `content/` directory: |
| 46 | + |
| 47 | +```md [content/index.md] |
| 48 | +# My title |
| 49 | + |
| 50 | +This first paragraph will be treated as the page meta description. |
| 51 | +``` |
| 52 | + |
| 53 | +You can overwrite meta tags by using front-matter: |
| 54 | + |
| 55 | +```md [content/index.md] |
| 56 | +--- |
| 57 | +title: 'Custom title' |
| 58 | +description: 'Custom meta description' |
| 59 | +image: 'Custom image injected as `og:image`' |
| 60 | +--- |
| 61 | + |
| 62 | +# My title |
| 63 | + |
| 64 | +This first paragraph will be treated as the page meta description. |
| 65 | +``` |
| 66 | + |
| 67 | +This is done thanks to Nuxt Content's [document-driven mode](https://content.nuxtjs.org/guide/writing/document-driven) of Nuxt Content. |
| 68 | + |
| 69 | +### Navigation |
| 70 | + |
| 71 | +The navigation is generated from your pages, you can take a look at the [`<Navbar>`](https://github.com/Atinux/content-wind/blob/main/theme/components/Navbar.vue) component to see how it works. |
| 72 | + |
| 73 | +It uses the [`<ContentNavigation>`](https://content.nuxtjs.org/api/components/content-navigation) component from Nuxt Content to fetch the navigation object. |
| 74 | + |
| 75 | +To customize the title displayed in the navigation, you can set the `navigation.title` property in the front-matter of your pages: |
| 76 | + |
| 77 | +```md |
| 78 | +--- |
| 79 | +navigation.title: 'Home' |
| 80 | +--- |
| 81 | + |
| 82 | +# Welcome to my site |
| 83 | + |
| 84 | +With a beautiful description |
| 85 | +``` |
| 86 | + |
| 87 | +### Theme configuration |
| 88 | + |
| 89 | +You can configure Content Wind global configuration in the `app.config.ts` file: |
| 90 | + |
| 91 | +```ts [signature] |
| 92 | +interface AppConfigInput { |
| 93 | + cover?: string, // default: '/cover.jpg' |
| 94 | + socials?: { |
| 95 | + twitter?: string |
| 96 | + github?: string |
| 97 | + } |
| 98 | +} |
| 99 | +``` |
| 100 | + |
| 101 | +Example of settings Twitter and GitHub icons in the navbar: |
| 102 | + |
| 103 | +```ts [app.config.ts] |
| 104 | +export default defineAppConfig({ |
| 105 | + socials: { |
| 106 | + twitter: 'Atinux', |
| 107 | + github: 'Atinux/content-wind' |
| 108 | + } |
| 109 | +}) |
| 110 | +``` |
| 111 | + |
| 112 | +### Icons |
| 113 | + |
| 114 | +Use any icon from [icones.js.org](https://icones.js.org) with the `<Icon>` component: |
| 115 | + |
| 116 | +```html |
| 117 | +<Icon name="ph:music-notes-fill" /> |
| 118 | +``` |
| 119 | + |
| 120 | +You can also use it in your Markdown: |
| 121 | + |
| 122 | +```md |
| 123 | +:icon{name="ph:music-notes-fill"} |
| 124 | +``` |
| 125 | + |
| 126 | +Will result in :icon{name="ph:music-notes-fill"} |
| 127 | + |
| 128 | +Learn more on [nuxt-icon](https://github.com/Atinux/nuxt-icon) documentation. |
| 129 | + |
| 130 | +### Code Highlight |
| 131 | + |
| 132 | +It supports code highlighting with Shiki and as well as different [VS Code themes](https://github.com/shikijs/shiki/blob/main/docs/themes.md#all-themes). |
| 133 | + |
| 134 | +::markdown-block |
| 135 | +\```ts |
| 136 | +export default () => 'Hello Content Wind' |
| 137 | +\``` |
| 138 | +:: |
| 139 | + |
| 140 | +Will result in: |
| 141 | + |
| 142 | +```ts |
| 143 | +export default () => 'Hello Content Wind' |
| 144 | +``` |
| 145 | + |
| 146 | +Updating the theme is as simple as editing your `nuxt.config`: |
| 147 | + |
| 148 | +```ts |
| 149 | +import { defineNuxtConfig } from 'nuxt' |
| 150 | + |
| 151 | +export default defineNuxtConfig({ |
| 152 | + content: { |
| 153 | + highlight: { |
| 154 | + theme: 'one-dark-pro', |
| 155 | + } |
| 156 | + } |
| 157 | +}) |
| 158 | +``` |
| 159 | + |
| 160 | +Learn more in the [Content Code Highlight section](https://content.nuxtjs.org/api/configuration#highlight). |
| 161 | + |
| 162 | +### Vue Components |
| 163 | + |
| 164 | +Add Vue components into the `components/content/` directory and start using them in Markdown. |
| 165 | + |
| 166 | +See the `<MarkdownBlock>` component in [`components/content/MarkdownBlock.vue`](https://github.com/Atinux/content-wind/blob/main/components/content/MarkdownBlock.vue). |
| 167 | + |
| 168 | +By leveraging the [`<ContentSlot>`](https://content.nuxtjs.org/api/components/markdown) component from Nuxt Content, you can use both slots and props in Markdown thanks to the [MDC syntax](https://content.nuxtjs.org/guide/writing/mdc). |
| 169 | + |
| 170 | + |
| 171 | +## Deployment |
| 172 | + |
| 173 | +[](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FAtinux%2Fcontent-wind-template) [](https://app.netlify.com/start/deploy?repository=https://github.com/Atinux/content-wind-template) |
| 174 | + |
| 175 | + |
| 176 | +### Static Hosting |
| 177 | + |
| 178 | +Pre-render the website to be deployed on any static hosting: |
| 179 | + |
| 180 | +```bash |
| 181 | +npm run generate |
| 182 | +``` |
| 183 | + |
| 184 | +The `dist/` directory is ready to be deployed (symlink to `.output/public`), [learn more on Nuxt docs](https://nuxt.com/docs/getting-started/deployment#static-hosting). |
| 185 | + |
| 186 | +### Node server |
| 187 | + |
| 188 | +Build the application for production: |
| 189 | + |
| 190 | +```bash |
| 191 | +npm run build |
| 192 | +``` |
| 193 | + |
| 194 | +Start the server in production: |
| 195 | + |
| 196 | +```bash |
| 197 | +node .output/server/index.mjs |
| 198 | +``` |
| 199 | + |
| 200 | +Learn more on [Nuxt docs](https://nuxt.com/docs/getting-started/deployment) for more information. |
| 201 | + |
| 202 | +--- |
| 203 | + |
| 204 | +You are at the end of the page, you can checkout the [about page](/about) or the [GitHub repository](https://github.com/Atinux/content-wind) and give a :icon{name="ph:star-duotone"} |
| 205 | + |
| 206 | +Thanks for reading and happy writing, [Atinux](https://twitter.com/Atinux). |
0 commit comments