9 */
10
11module.exports = function(eleventyConfig) {
12 eleventyConfig.setTemplateFormats([
13 // Templates:
48 - Read the Next Steps post to learn how to extend this
49 */
50 eleventyConfig.addCollection("posts", function(collection) {
51 /* The posts collection includes all posts that list 'posts' in the front matter 'tags'
52 - https://www.11ty.dev/docs/collections/
2
3// Simple template engine for processing Nunjucks-like templates
4function processTemplate(template: string, data: any): string {
5 let result = template;
6
43}
44
45function getNestedValue(obj: any, path: string): any {
46 return path.split(".").reduce((current, key) => {
47 if (current && typeof current === "object") {
52}
53
54function evaluateCondition(condition: string, data: any): boolean {
55 // Simple condition evaluation - just check if variable exists and is truthy
56 const value = getNestedValue(data, condition);
171};
172
173function formatDate(date: Date): string {
174 return date.toLocaleDateString("en-US", {
175 year: "numeric",
179}
180
181export default async function(req: Request): Promise<Response> {
182 const url = new URL(req.url);
183 const path = url.pathname;
15}
16// Simple hook for mobile menu toggle
17function useMobileMenu() {
18 const [isOpen, setIsOpen] = useState(false);
19 const toggleMenu = () => setIsOpen(!isOpen);
23
24// Simple hook for tracking current hash for active nav styling
25function useCurrentHash() {
26 const [currentHash, setCurrentHash] = useState(() =>
27 window.location.hash.slice(1)
40}
41
42export function App({ initialData }: AppProps) {
43 // initialData
44 const { demoData, loading, error } = initialData;
365 <h3>Documentation excerpt</h3>
366 <p>
367 Glance cobrowse provides a “hook” function to allow
368 customers to customize page and element masking during a
369 cobrowse session.
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});
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.