Write Articles
Write Articles
Write Markdown articles in Alpine is straightforward.
Create an articles list
Create a new file in the content/
directory:
touch content/2.articles.md
The numbered prefix determines the order of the menu items.
In this file, use the articles-list
component to display the list of articles:
---title: 'Articles'layout: 'page'---::articles-list---path: articles---::
The path
prop corresponds to the directory where the articles are stored.
Display an article in the list
Create a new file in the /content/articles
directory:
mkdir content/articlestouch content/articles/1.my-new-article.md
For your article to be correctly displayed in the articles list, define a cover
and date
property in the frontmatter:
---cover: path/to/coverdate: 2022-08-23---
The cover
property can be a local path relative to the /public
directory or an external URL.
Your article will now be displayed in the list with its filename as a default title.
Edit your article
Under the frontmatter block, enter a Markdown h1
tag and a line of text:
---cover: path/to/coverdate: 2022-08-23---# An awesome articleThis article is little by size but big by heart.
Your article will now be displayed in the list with the title and description you wrote in Markdown.
Override title and description
If you want to change the title and description displayed on the list and in the meta tags of the article, add the title
and description
property to your frontmatter:
---cover: path/to/coverdate: 2022-08-23title: Another titledescription: Another description---
You are now ready to edit your article and create new ones!
Optional Arguments
In the frontmatter block, you can pass additional options for displaying your article, such as displaying badges on the image:
---cover: path/to/coverdate: 2022-08-23badges: [{ color: 'white', bg: 'rgba(0, 0, 0, 0.3)', content: 'Technology'}]---
Read more
Alpine is a Nuxt theme using the Content module in documentDriven
mode.
👉 Learn more in the Nuxt Content documentation.