Closed loops are working well. 2 flavours, deterministic & evaluative.
What are others doing? What tools do you use for evaluative loops?
@ClaudeDevs @OpenAIDevs @cursor_ai
I've seen a few vids from @trq212 but I'd love more detailed examples for evaluative loops.
Got a message this am from @AnthropicAI telling me fable 5 is in my max 20 account, I thought, yay, my ban must have been over turned (rightfully so)... But alas, my account is not accessible.
@AnthropicAI @claudeai - come on now, I've been "next inline" for a review for 12hrs!
Sorry to shout publicly but the support system isn't very good. @bcherny @trq212 @janleike - per my last post, I'm UK based and my account got closed due to supported countries policy. I work from the UK, a supported country. Who can I speak to about this? @AnthropicAI
Yo, @claudeai I am (was) a @ClaudeDevs until a little while ago when my account got banned for violation of supported countries policy.
I'm UK based, always have been, only time I've used Claude in another country was a work trip to Netherlands. @AnthropicAI pls help!!
David retweeted
I finished it, a few hours GPhighlights.com
Sign up, and we will email you as soon as the highlight video from the F1 session is published. No spoilers + links to all other race sessions going back to 2020
if you like f1 would love if you could share it :)
Woke up early to watch the F1 qualifying last weekend and found my website was down. Host took us down due to missed payment, no dunning, straight up took the site offline.
This pissed me off, so between 5am and 2pm I created a new site. Missed the F1 quali as a result.
As it happens we were already starting a website rebuild, we were using one of the many site builders and kept running into limitations so the decision was already made to move.
This just moved the timeline up a lot. It went from a task that we looked at when we had free time to being my only focus for 7 hours. I do tend to focus better when my back is against the wall like this so Im thankful for the motivation increase!
I decided to make use of Sveltekit for our site, although not an obvious choice for a static website, its what we use for our app so we are all able to update.
I have written posts on the steps taken to get the website up and running here: medium.com/@templateto_david⦠and here: medium.com/@templateto_davidā¦
The building of the new site....
Our requirements for any framework were:
MarkDown for blog posts
Uses mdsvex
Static adapter (100%)
Site map
Author pages
Categories
FAST
TailwindCSS
After looking around we came across the sveltekit blog starter by Josh Collinsworth
It didn't cover all of our requirements but it covered using mdsvex, static adapter, categories and being fast. So it seemed like a good foundation.
One annoyance: I use Windows, and the way the static rendering works is via an entries list. This list makes use of * wildcard, and this doesn't work when building on Windows. Dev mode works just fine, but you can't build the project. I use Github actions for the build and deploy. This is Linux, and the build works just fine there, so other than occasionally breaking the build, this wasn't a big setback.
Getting started
I started by adding TailwindCSS, this is a super simple process, just follow the instructions instructions on the Tailwind website for Sveltekit.
Adding Author and Category pages
I added Author pages, to do this I followed the pattern that Josh had already put in place for blog posts, look at the [post] folder under /blog to see what I mean.
In the starter, categories are essentially tags that can be added as a list on a post. I wanted to make categories a little more feature rich. I wanted to associate a colour with each category and I wanted to be able to have some control over the content at the top of each category page. To do this I followed the pattern for Posts and now Authors. So each category has an MD file that get rendered at the top of the category page.
I added fetch files for authors and categories, again following the pattern already in place for posts. With this in place, I could quickly get these different pages up and running. I extended posts to pull in the category information from the category pages when a post references a category. Added queries to get all posts for a category as well. I wasn't too concerned about the performance of these queries as this all happens as build time.
Table of Content Generation
I wanted posts to have a table of content based on the H2 tags within a post. There are lots of way to achieve this, I decided to go with a pre-build step to generate a json file. If you've seen my other post, you will know I was trying to get a site up as quickly as possible, So in my pre-build step I added a call to this code:
import fs from 'fs';
import path from 'path';
import { execSync } from 'child_process';
import removeMd from 'remove-markdown';
const directoryPath = path.join(process.cwd(), 'src', 'lib', 'posts');
export function processToc(){
// Loop through all files in the directory
fs.readdir(directoryPath, (err, files) => {
if (err) {
console.error('Could not list the directory.', err);
process.exit(1);
}
files.forEach((file) => {
if (path.extname(file) === '.md') {
const filePath = path.join(directoryPath, file);
const newFilePath = filePath.replace('.md', '.json');
try {
// Generate ToC and save to a JSON file
const tocJson = JSON.parse(execSync(`markdown-toc --json ${filePath}`));
tocJson.forEach(item => {
item.content = removeMd(item.content);
});
fs.writeFileSync(newFilePath, JSON.stringify(tocJson));
console.log(`Table of Contents JSON for ${file} has been saved as ${path.basename(newFilePath)}`);
} catch (error) {
console.error(`Error generating ToC for ${file}: ${error}`);
}
}
});
});
}
I then load the table of content for a post in the `/routes/blog/[post]/+page.js` with this line: `const toc = await import(ā../../../lib/posts/${params.post}.jsonā);`
This works pretty well for me, I was able to make use of existing tools (markdown-toc) to get the information to build the table of content.
Adding a Sitemap
With the different page types in place and the fetch functions created I then worked on the sitemap. To get this to work across the whole site, not just for these pages I did the following:
const modules = import.meta.glob(['../**.svelte', '../**/**.svelte', '../**.md','../*/**.md','../*/**.svelte', '!../blog/**' ])
let pages = new Set(); // Use a Set to avoid duplicate entries
pages.add({title: siteTitle, path: "/"});
for (let modulePath in modules) {
let pathSanitized = modulePath.replace(/^\.\.\//, ""); // Remove the "../" from the beginning
let pathParts = pathSanitized.split('/'); // Split the path by "/"
// Check if the path has more than one part (indicating a folder)
if (pathParts.length > 1) {
let folderPath = '/' + pathParts.slice(0, -1).join('/'); // Join the parts back together, excluding the last part (file name)
let title = pathParts.slice(-2)[0];
//Lets get the last date the page was edited.
const filePath = path.resolve('src', 'routes', ...pathParts);
const stats = await fs.stat(filePath);
pages.add({title: title, path: folderPath, lastModified: stats.mtime.toISOString()}); // Add the folder path to the set
}
}
This is a subsection from the overall sitemap page list builder. For authors, categories, and posts, I used the fetch functions and constructed the path. Each of the post types has an update date that I used for the lastModified.
Performance
The site was already very fast, sveltekit and the static adapter are really good. One thing that I didn't like was that modules are set to preload, this is advantageous for an SPA but less so for a static site. It impacted on the results I got from page insights. I wasn't the first person to have issues github.com/vitejs/vite/issue⦠ā Although this is āclosedā i found the issue to persist. After much messing about, I landed on the following in hooks.server.js
import * as cheerio from 'cheerio';
/**
* Modifies the response in-place to fix the link rel="modulepreload" issue.
*
* Note that this fix causes significant server-side processing time increase -
* do not use long term, only proper fix is to fix Vite.
*
* For the source of the issue of loading times please see github.com/vitejs/vite/issueā¦
*
*/
function fixLinkModulePreloadIssue(body) {
const $ = cheerio.load(body);
const header = $("head");
const bodyEl = $("body");
$('link[rel="modulepreload"]').each(function(idx, elem) {
const $this = $(elem);
const src = $this.attr('href');
$(`<script defer type="module" src="${src}"></script>`).appendTo(bodyEl);
$this.remove();
});
return $.html();
}
/** @type {import('@sveltejs/kit').Handle} */
export async function handle({ event, resolve }) {
const response = await resolve(event);
if (response.headers.get('Content-Type') === "text/html") {
// Convert the response body to text to process it
const body = await response.text();
// Get the modified HTML content
const modifiedBody = fixLinkModulePreloadIssue(body);
// Create a new Response object with the modified body
const newResponse = new Response(modifiedBody, {
// Copy the status and headers from the original response
status: response.status,
headers: response.headers
});
return newResponse;
}
return response;
}
This is a modified version of an answer on this thread: stackoverflow.com/questions/ā¦
You should only do this if you are creating a static site, it will impact performance otherwise, in a static site it only impacts the build time (which is still fine btw).
Build & Host
As we do for all of our code, we chose to build with github actions. This was very easy to get up and running. We build within the action and at the end push the static output to a branch, making use of ghp-import
For hosting we chose Cloudflare pages, its fast, easy and for us, free. So its really a no-brainer. All we had to do was connect it to github and point it at the gh-pages branch.
Our github action workflow:
name: Build and Release
on:
push:
branches:
- main
permissions:
contents: write
issues: write
pull-requests: write
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20.11.0'
- name: Install markdown-toc
run: npm install -g markdown-toc
- name: Install dependencies
run: npm install
- name: Build project
run: npm run build
# Deploys the built site to the branch
- name: Install ghp-import
run: pip install ghp-import
- name: Deploy to GitHub Pages
run: ghp-import -n -p -f -o build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Conclusion
With some small modification you can create fast and flexible static sites with Sveltekit and markdown. A huge thanks to Josh for creating and maintaining the starter site, if you go this far please go give him a star on github. github.com/josh-collinsworthā¦
We are super happy with the new TemplateTo website, there is more work to be done but we have a great foundation.
Is marketing Twitter/X a thing? How do I find it and interact if so? Do hashtags still work?
#Marketing #DigitalMarketing #SaaS
Not had a signup for about half a day, at this point this is strange enough that I go and check that everything is working correctly. It is.
Just had to take a moment and reflect on the difference from a year ago, when getting a signup a day was good going.
Persistence is key
First medium post for TemplateTo: medium.com/@templateto_davidā¦
Trying to find a writing style, don't want to sound corporate, which Ive been told I do... So I tried to write it similar to how I think, if that makes any sense. Basically removing a layer or two of filter.
Would appreciate any feedback.
#buildinpublic
Im currently in the process of building a dynamic table control for TemplateTo.
Id appreciate any feedback. It is still very much in progress but I think that's the best time to take on any feedback š
If you think its shite please say so, but please also give some direction so I can try and make it less so!
Also, Im sorry for the sound, not sure what was going on with that.
#buildinpublic
Working on more components for TemplateTo. Nearly there with components now though.
Next up is workflows, we are starting simple but excited to see what users will do with them.
#buildinpublic
David retweeted
This SEO strategy brought in 43%+ visitors (!)
Adding 20% more organic revenue.
Itās no secret hack.
Everyone can do it.
RT + Comment 'SEO' to get my free cheat sheet! š
David retweeted
I make $40,000/month with my SaaS.
I used strategies nobody's talking about.
Comment 'SAAS'
RT this tweet.
I'll share a 15 min. video where I outline EVERYTHING.
Don't want to pay 10% in fees to do business through @gumroad #gumroad you must give @shoprocket some consideration.
Fixed monthly fee with Shoprocket.
If you make $300 a month currently, you will save $ by switching to ShopRocket.
shoprocket.io/register - Get a trial.
Replying to @joserosado @gumroad
Iāve been building @shoprocket (pretty quietly š
) for almost 10 years now, we donāt take a % of your sales and you can embed it seamlessly into your own website/blog and sell everywhere at once. Connect your own stripe/PayPal and get paid instantly.
Shoprocket.io







