Skip to content

Commit e6fd9fc

Browse files
authored
Merge pull request #20 from jottenlips/feature/sitemap2
2 parents 95630a2 + e91340e commit e6fd9fc

14 files changed

Lines changed: 321 additions & 13 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ _release
88
*.install
99
public/
1010
/public
11-
markdown/
1211
/markdown
1312

1413
.DS_Store

agave-generator.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
opam-version: "2.0"
22
name: "agave-generator"
3-
version: "0.2.4"
3+
version: "0.2.5"
44
synopsis: "Minimal markdown to HTML static site generator"
55
description: """
66
Minimal markdown to HTML for static sites with pretty URLs.

docs/sitemap/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<a href="/sitemap/">Sitemap</a>
2222
</nav>
2323
<main>
24-
<div id="sitemap-container"><input type="text" id="sitemap-search" placeholder="Search pages..." style="width:100%;padding:8px;margin-bottom:16px;box-sizing:border-box;font-size:16px;" /><ul id="sitemap-results" style="list-style:none;padding:0;"></ul></div><script>var pages = [{"url":"/markdown-tips/","title":"Markdown Tips and Tricks","description":"Power user tips for writing great content in Agave","filename":"markdown-tips"},{"url":"/deploying/","title":"Deploying Your Agave Site","description":"How to deploy your static site to GitHub Pages, Netlify, or any host","filename":"deploying"},{"url":"/getting-started/","title":"Getting Started with Agave","description":"A beginner's guide to building your first static site with Agave","filename":"getting-started"},{"url":"//","title":"Blog","description":"Latest posts from the Agave blog","filename":"index"},{"url":"/contact/","title":"Contact Us","description":"Get in touch with the Agave team","filename":"contact"},{"url":"//","title":"Agave Test Site","description":"A demo site built with Agave static site generator","filename":"index"},{"url":"/about/","title":"About Agave","description":"Agave is a simple static site generator written in ReasonML","filename":"about"}];var input = document.getElementById('sitemap-search');var results = document.getElementById('sitemap-results');function render(filter) { var q = filter.toLowerCase(); results.innerHTML = ''; pages.forEach(function(p) { if (!q || p.title.toLowerCase().indexOf(q) !== -1 || p.description.toLowerCase().indexOf(q) !== -1 || p.filename.toLowerCase().indexOf(q) !== -1) { var li = document.createElement('li'); li.style.marginBottom = '12px'; li.innerHTML = '<a href="' + p.url + '">' + p.title + '</a>' + (p.description ? '<br/><small>' + p.description + '</small>' : ''); results.appendChild(li); } });}input.addEventListener('input', function() { render(this.value); });render('');</script>
24+
<div id="sitemap-container"><input type="text" id="sitemap-search" placeholder="Search pages..." style="width:100%;padding:8px;margin-bottom:16px;box-sizing:border-box;font-size:16px;" /><div id="sitemap-results"></div></div><script>var pages = [{"url":"/blog/markdown-tips/","title":"Markdown Tips and Tricks","description":"Power user tips for writing great content in Agave","filename":"markdown-tips"},{"url":"/blog/deploying/","title":"Deploying Your Agave Site","description":"How to deploy your static site to GitHub Pages, Netlify, or any host","filename":"deploying"},{"url":"/blog/getting-started/","title":"Getting Started with Agave","description":"A beginner's guide to building your first static site with Agave","filename":"getting-started"},{"url":"/blog/","title":"Blog","description":"Latest posts from the Agave blog","filename":"index"},{"url":"/contact/","title":"Contact Us","description":"Get in touch with the Agave team","filename":"contact"},{"url":"/","title":"Agave Test Site","description":"A demo site built with Agave static site generator","filename":"index"},{"url":"/about/","title":"About Agave","description":"Agave is a simple static site generator written in ReasonML","filename":"about"}];var input = document.getElementById('sitemap-search');var results = document.getElementById('sitemap-results');function buildTree(items) { var root = { children: {}, pages: [] }; items.forEach(function(p) { var parts = p.url.replace(/^\/+|\/+$/g, '').split('/').filter(function(s) { return s.length > 0; }); if (parts.length === 0) { root.pages.push(p); } else { var node = root; for (var i = 0; i < parts.length - 1; i++) { if (!node.children[parts[i]]) { node.children[parts[i]] = { children: {}, pages: [], key: parts[i] }; } node = node.children[parts[i]]; } node.pages.push(p); } }); return root;}function renderTree(node, container) { var ul = document.createElement('ul'); ul.style.listStyle = 'none'; ul.style.paddingLeft = container === results ? '0' : '20px'; var sortedPages = node.pages.slice().sort(function(a, b) { return a.title.toLowerCase().localeCompare(b.title.toLowerCase()); }); sortedPages.forEach(function(p) { var li = document.createElement('li'); li.style.marginBottom = '8px'; li.innerHTML = '<a href="' + p.url + '">' + p.title + '</a>' + (p.description ? '<br/><small>' + p.description + '</small>' : ''); ul.appendChild(li); }); var keys = Object.keys(node.children).sort(function(a, b) { var aNode = node.children[a]; var bNode = node.children[b]; var aLabel = aNode.pages.length > 0 ? aNode.pages[0].title : a; var bLabel = bNode.pages.length > 0 ? bNode.pages[0].title : b; return aLabel.toLowerCase().localeCompare(bLabel.toLowerCase()); }); keys.forEach(function(k) { var child = node.children[k]; var li = document.createElement('li'); li.style.marginBottom = '8px'; li.style.marginTop = '12px'; var label = k.charAt(0).toUpperCase() + k.slice(1).replace(/-/g, ' '); li.innerHTML = '<strong>' + label + '</strong>'; ul.appendChild(li); renderTree(child, li); }); container.appendChild(ul);}function renderFlat(items) { var ul = document.createElement('ul'); ul.style.listStyle = 'none'; ul.style.paddingLeft = '0'; items.sort(function(a, b) { return a.title.toLowerCase().localeCompare(b.title.toLowerCase()); }).forEach(function(p) { var li = document.createElement('li'); li.style.marginBottom = '8px'; li.innerHTML = '<a href="' + p.url + '">' + p.title + '</a>' + (p.description ? '<br/><small>' + p.description + '</small>' : ''); ul.appendChild(li); }); results.appendChild(ul);}function render(filter) { var q = filter.toLowerCase(); results.innerHTML = ''; if (q) { var matched = pages.filter(function(p) { return p.title.toLowerCase().indexOf(q) !== -1 || p.description.toLowerCase().indexOf(q) !== -1 || p.filename.toLowerCase().indexOf(q) !== -1; }); renderFlat(matched); } else { var tree = buildTree(pages); renderTree(tree, results); }}input.addEventListener('input', function() { render(this.value); });render('');</script>
2525
</main>
2626
<footer>
2727
<p>Built with Agave</p>

example/markdown/about.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
@title About Agave
2+
@description Agave is a simple static site generator written in ReasonML
3+
4+
# About Agave
5+
6+
Agave is a lightweight static site generator that turns markdown files into a website.
7+
8+
## Features
9+
10+
- Markdown to HTML conversion
11+
- Custom templates with `base.html`
12+
- Per-page meta tags via shorthand notation
13+
- Built-in themes (desert, randomphoto)
14+
- Client-side searchable sitemap
15+
- Local dev server
16+
17+
## How It Works
18+
19+
Drop your `.md` files into a directory, add a `base.html` template, and run `agave`. That's it.

example/markdown/base.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Agave Test Site</title>
7+
<link rel="stylesheet" href="/styles.css">
8+
</head>
9+
<body>
10+
<nav>
11+
<a href="/">Home</a>
12+
<a href="/about/">About</a>
13+
<a href="/blog/">Blog</a>
14+
<a href="/sitemap/">Sitemap</a>
15+
</nav>
16+
<main>
17+
<!-- MARKDOWN -->
18+
</main>
19+
<footer>
20+
<p>Built with Agave</p>
21+
</footer>
22+
</body>
23+
</html>

example/markdown/blog/deploying.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
@title Deploying Your Agave Site
2+
@description How to deploy your static site to GitHub Pages, Netlify, or any host
3+
4+
# Deploying Your Agave Site
5+
6+
Once you've built your site, deploying is straightforward since it's just static files.
7+
8+
## GitHub Pages
9+
10+
1. Push your `public` directory to a `gh-pages` branch
11+
2. Enable GitHub Pages in your repo settings
12+
3. Your site is live!
13+
14+
## Netlify
15+
16+
1. Connect your repository
17+
2. Set build command: `dune exec bin/Agave.exe -- -m markdown -p public`
18+
3. Set publish directory: `public`
19+
20+
## Any Static Host
21+
22+
The `public` directory contains plain HTML, CSS, and nothing else. Upload it anywhere that serves static files — S3, Cloudflare Pages, Vercel, or even a simple nginx server.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
@title Getting Started with Agave
2+
@description A beginner's guide to building your first static site with Agave
3+
4+
# Getting Started with Agave
5+
6+
Setting up your first Agave site takes just a few minutes.
7+
8+
## Installation
9+
10+
Install via opam or build from source:
11+
12+
```
13+
dune build
14+
dune install
15+
```
16+
17+
## Create Your First Site
18+
19+
1. Create a `markdown` directory
20+
2. Add a `base.html` template with `<!-- MARKDOWN -->` placeholder
21+
3. Write some `.md` files
22+
4. Run `agave -m markdown -p public`
23+
24+
## Adding Meta Tags
25+
26+
Use shorthand notation at the top of your markdown files:
27+
28+
```
29+
@title My Page Title
30+
@description A brief description of this page
31+
@image /images/hero.jpg
32+
```
33+
34+
These get injected as Open Graph and Twitter Card meta tags automatically.

example/markdown/blog/index.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@title Blog
2+
@description Latest posts from the Agave blog
3+
4+
# Blog
5+
6+
Recent articles:
7+
8+
- [Getting Started with Agave](/blog/getting-started/)
9+
- [Markdown Tips and Tricks](/blog/markdown-tips/)
10+
- [Deploying Your Site](/blog/deploying/)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@title Markdown Tips and Tricks
2+
@description Power user tips for writing great content in Agave
3+
4+
# Markdown Tips and Tricks
5+
6+
Get the most out of your Agave markdown files.
7+
8+
## Headings Structure
9+
10+
Use `#` for the page title, `##` for sections, and `###` for subsections. Agave will automatically extract the first heading for meta tags if you don't specify `@title`.
11+
12+
## Code Blocks
13+
14+
Wrap code in triple backticks for syntax highlighting:
15+
16+
```javascript
17+
const greeting = "Hello from Agave!";
18+
console.log(greeting);
19+
```
20+
21+
## Lists
22+
23+
Both ordered and unordered lists work great:
24+
25+
- Bullet points with `-`
26+
- Nested items supported
27+
- Like this one
28+
29+
1. Numbered lists
30+
2. Auto-increment
31+
3. Easy to maintain
32+
33+
## Links and Images
34+
35+
Standard markdown links and images are fully supported. Use relative paths for internal links to keep your site portable.

example/markdown/contact.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@title Contact Us
2+
@description Get in touch with the Agave team
3+
4+
# Contact
5+
6+
Have questions or feedback? Reach out!
7+
8+
- GitHub: [github.com/jottenlips/agave](https://github.com/jottenlips/agave)
9+
- Issues: Open a ticket on the repo
10+
11+
We'd love to hear how you're using Agave.

0 commit comments

Comments
 (0)