Skip to content

Commit

Permalink
Small formatting clean ups.
Browse files Browse the repository at this point in the history
  • Loading branch information
twostraws committed Sep 26, 2024
1 parent f303998 commit 02c14ae
Showing 1 changed file with 27 additions and 22 deletions.
49 changes: 27 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,27 +151,31 @@ Ignite sites are just Swift package, but they use a specific folder structure to

This folder structure is already in place in the [Ignite Starter Template](https://github.com/twostraws/IgniteStarter) repository, and I recommend you start with that.

## Create a layout to render your markdown files
As metioned above, adding markdown files to **Content** will render these to html pages and include them in **Build** with their respective folder structure (minus the **Content**).
## Create a layout to render Markdown files

Adding Markdown files to **Content** will render these to HTML pages and include them in **Build** with their respective folder structure, minus the **Content** part.

For example, adding a new file called `apps.md` to **Content** means having this folder structure:

Adding a new file called `apps.md` to content …
```bash
├── Content
│   └── apps.md
```
… adds this structure to **Build**:

And it results inn this **Build** structure:

```bash
├── Build
│   ├── …
│   ├── apps
│   │   └── index.html
│   ├── …
```
**A precondition for this to work is to have a layout availabe.** Failing to having bound in such a layout will result in the following warning when running the package in Xcode:
```
Your site must provide at least one layout in order to render Markdown.
```
Such a layout can look like this:

**A precondition for this to work is to have a layout available to render your content.** If you don't have a valid layout in place, Ignite will issue a warning saying "Your site must provide at least one layout in order to render Markdown."

You can create custom layouts by making types conform to the `ContentPage` protocol. For example:

```swift
import Foundation
import Ignite
Expand Down Expand Up @@ -201,24 +205,25 @@ struct Layout: ContentPage {
}
}
```
What remains to be done is to include this layout into the `Site`. This can be done by adding this new layout to the `layouts` property of the site:

Once you've defined a custom layout, you should add it to your `Site` struct. This can be done by adding this new layout to the `layouts` property of the site, like this:

```swift
struct ExampleSite: Site {
var name = "Hello World"
var titleSuffix = " – My Awesome Site"
var url: URL = URL("https://www.example.com")
var builtInIconsEnabled = true

var author = "John Appleseed"

var homePage = Home()
var theme = MyTheme()
var layouts: [any ContentPage] {
Layout()
}
var name = "Hello World"
var url: URL = URL("https://www.example.com")

var homePage = Home()
var theme = MyTheme()

/* This part adds the custom layout */
var layouts: [any ContentPage] {
Layout()
}
}
```


## Using the command-line tool

Once you have installed the Ignite command-line tool from this repository, you can use it in various ways.
Expand Down

0 comments on commit 02c14ae

Please sign in to comment.