36## Features
37
38- ✅ **Working Blog** - Fully functional with multiple posts
39- ✅ **Responsive Design** - Mobile-friendly layout
40- ✅ **Post Collections** - Organized blog posts with metadata
94This implementation demonstrates 11ty concepts while working within Val Town's serverless environment. The original 11ty configuration files are preserved to show the intended structure, but the actual serving is handled by a custom TypeScript handler that mimics 11ty's output.
95
96The blog is fully functional and demonstrates all the key features you'd expect from an 11ty static site!
44```javascript
45// Here's some sample code with syntax highlighting
46function welcomeMessage(name) {
47 return `Welcome to the blog, ${name}!`;
48}
97.token.atrule,
98.token.attr-value,
99.token.function,
100.token.class-name {
101 color: #e6db74;
50Block code:
51```javascript
52function greet(name) {
53 return `Hello, ${name}!`;
54}
2
3// Simple template engine for processing Nunjucks-like templates
4function processTemplate(template: string, data: any): string {
5 let result = template;
6
39}
40
41function getNestedValue(obj: any, path: string): any {
42 return path.split('.').reduce((current, key) => {
43 if (current && typeof current === 'object') {
48}
49
50function evaluateCondition(condition: string, data: any): boolean {
51 // Simple condition evaluation - just check if variable exists and is truthy
52 const value = getNestedValue(data, condition);
164};
165
166function formatDate(date: Date): string {
167 return date.toLocaleDateString('en-US', {
168 year: 'numeric',
172}
173
174export default async function(req: Request): Promise<Response> {
175 const url = new URL(req.url);
176 const path = url.pathname;
1const { DateTime } = require("luxon");
2
3module.exports = function(eleventyConfig) {
4 // Copy static assets
5 eleventyConfig.addPassthroughCopy("src/css");
33
34 // Create a collection for blog posts
35 eleventyConfig.addCollection("posts", function(collectionApi) {
36 return collectionApi.getFilteredByGlob("src/posts/*.md").sort((a, b) => {
37 return b.date - a.date; // Sort by date descending
40
41 // Create a collection for featured posts
42 eleventyConfig.addCollection("featuredPosts", function(collectionApi) {
43 return collectionApi.getFilteredByGlob("src/posts/*.md")
44 .filter(post => post.data.featured)
29```javascript
30// In .eleventy.js
31eleventyConfig.addCollection("posts", function(collectionApi) {
32 return collectionApi.getFilteredByGlob("src/posts/*.md");
33});
97.token.atrule,
98.token.attr-value,
99.token.function,
100.token.class-name {
101 color: #e6db74;
50Block code:
51```javascript
52function greet(name) {
53 return `Hello, ${name}!`;
54}
29```javascript
30// In .eleventy.js
31eleventyConfig.addCollection("posts", function(collectionApi) {
32 return collectionApi.getFilteredByGlob("src/posts/*.md");
33});
A helper function to build a file's email
Simple functional CSS library for Val Town
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.