Init Commit
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: "Articles"
|
||||
date: 2024-01-01
|
||||
draft: false
|
||||
description: "In-depth articles and tutorials"
|
||||
---
|
||||
|
||||
Welcome to the articles section. Here you'll find comprehensive articles, tutorials, and deep-dive content on various topics related to web development, technology, and best practices.
|
||||
|
||||
This section demonstrates how Hugo automatically creates sections from content folders, making it easy to organize different types of content.
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
title: 'First Article'
|
||||
date: 2024-01-15T10:00:00+00:00
|
||||
draft: false
|
||||
tags:
|
||||
- tutorial
|
||||
- beginner
|
||||
---
|
||||
|
||||
This is the first article content. Hugo sections allow you to organize content into logical groups, and each section gets its own URL path.
|
||||
|
||||
## What are Hugo Sections?
|
||||
|
||||
Hugo sections are a way to organize your content into logical groups. When you create a folder under `content/`, Hugo automatically treats it as a section.
|
||||
|
||||
## Benefits of Using Sections
|
||||
|
||||
- **Organization**: Keep related content together
|
||||
- **URLs**: Automatic URL structure (`/articles/`, `/news/`, etc.)
|
||||
- **Templates**: Custom layouts for different content types
|
||||
- **RSS**: Each section gets its own RSS feed
|
||||
|
||||
## Example Structure
|
||||
|
||||
```
|
||||
content/
|
||||
├── articles/
|
||||
│ ├── _index.md
|
||||
│ ├── first-article.md
|
||||
│ └── second-article.md
|
||||
└── news/
|
||||
├── _index.md
|
||||
└── breaking-news.md
|
||||
```
|
||||
|
||||
This creates accessible URLs like:
|
||||
- `/articles/` (section list)
|
||||
- `/articles/first-article/` (individual article)
|
||||
- `/news/` (section list)
|
||||
- `/news/breaking-news/` (individual news item)
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
title: 'Advanced Hugo Sections'
|
||||
date: 2024-01-20T14:30:00+00:00
|
||||
draft: false
|
||||
tags:
|
||||
- hugo
|
||||
- advanced
|
||||
- sections
|
||||
---
|
||||
|
||||
This is the second article, demonstrating how multiple articles appear in the same section.
|
||||
|
||||
## Advanced Section Features
|
||||
|
||||
Hugo sections provide powerful features for content organization:
|
||||
|
||||
### Custom Section Templates
|
||||
|
||||
You can create custom templates for each section by placing them in `layouts/SECTION/`:
|
||||
|
||||
- `layouts/articles/list.html` - for `/articles/` page
|
||||
- `layouts/articles/single.html` - for individual articles
|
||||
|
||||
### Section Variables
|
||||
|
||||
In templates, you can access section-specific data:
|
||||
|
||||
```go
|
||||
{{ .Section }} // "articles"
|
||||
{{ .Type }} // content type
|
||||
{{ .Pages }} // all pages in section
|
||||
{{ .RegularPages }} // only regular pages
|
||||
```
|
||||
|
||||
### Taxonomies per Section
|
||||
|
||||
Each section can have its own taxonomies (tags, categories) with independent organization.
|
||||
Reference in New Issue
Block a user