#Rebuilding my technical blog with Cline
##Table of Contents
- Introduction
- What appealed to me about Cline
- A conversation with Cline
- What I changed in the rebuild
- Features in the new blog
- What worked and what took care
- Wrapping up
##Introduction
I built this technical blog in September 2021 as a way to learn Next.js.
I started with features such as code blocks and Google Analytics, with every intention of continuing to improve the site.
Then life got busy. Work on the blog slowed, and eventually I stopped publishing articles too.
In this context, the VSCode extension "Cline" has been gaining attention.
This is a tool that uses LLM to assist with coding.
Since I had the opportunity to take a week of vacation, I decided to use this period to challenge myself to remake a technical blog using Cline.
##What appealed to me about Cline
As for Cline, many previous pioneers have already published articles and videos that explain it in detail.
Therefore, I would like to discuss the charm I felt when using Cline.
Cline is a powerful AI coding tool that leverages LLMs.
The greatest feature of this is that you can continue coding through natural language conversations.
You can feel like you're pair programming with a skilled engineer, and you can proceed with development smoothly.
Specifically, Cline can do the following.
- Understanding the file structure within the project: You can understand the overall structure of the project and quickly access the necessary files.
- File viewing: You can check the contents of the file and identify the areas for correction.
- Generation of code and documents: Based on instructions, the code and documents are automatically generated.
- Executing commands in the terminal and viewing results: You can execute commands and check the results within Cline.
- Browsing web pages with a headless browser: You can browse web pages and obtain information (you can also view the pages you have created).
- Using a variety of LLM models: You can switch between various LLM models.
Since these functions can be instructed in natural language, coding efficiency improves significantly.
Also, there are several derivative tools for Cline, but the one I used this time was "CoolCline".
Since I don't use other tools, I don't fully understand the differences, but it seems to be a collection of features such as "Roo Code" and "Bao-Cline".
##A conversation with Cline
Here’s an actual exchange to give you a feel for working with Cline.
The red boxes contain my messages. Cline’s replies are in blue.
I’d like the site to generate its sitemap automatically. Since I’m using Next.js, could you look into implementing it
with the feature described below? I want to keep ongoing costs low and make it easy to maintain. (I pasted the Next.js
documentation for generateSitemaps.)
To generate the sitemap in Next.js, I’ll look at the following:
- Project structure:
- Blog posts (posts/)
- Static pages (about, works, tags, and so on)
- Dynamic routes (posts/[id] and tags/[tag])
- Files needed:
- app/sitemap.ts for the main sitemap
- app/lib/constants.ts for constants such as BASE_URL
- Implementation:
- Generate the static entries separately from the article and tag entries.
- Use constants and helper functions to make the code easier to maintain.
- Use file metadata to determine when blog posts were updated.
I’ll start by creating constants.ts with the basic settings.
(Cline generated and proposed code for constants.ts.)
The site information is already in config/data.json. Can you import it from there?
I’ll check config/data.json to see how to read the site information.
(Cline inspected data.json.)
I can get the site information from config/data.json. I’ll update constants.ts and sitemap.ts to use it.
(Cline proposed revised code for constants.ts.)
Now that constants.ts is in place, I’ll check blog.ts to see how the site retrieves posts.
(Cline inspected blog.ts.)
I’ve checked blog.ts. I can use getAllPosts to retrieve published posts and getAllTags to generate the tag URLs. I’ll use both to build the sitemap.
(Cline proposed code for sitemap.ts.)
I’ve implemented automatic sitemap generation.
Implementation details:
- src/app/lib/constants.ts
- Read the site URL from config/data.json.
- Define sitemap priorities and update frequencies.
- src/app/sitemap.ts
- Generate URLs for static pages such as Home, About, and Works.
- Use getAllPosts to generate a URL for each published article and its date for lastModified.
- Use getAllTags to generate URLs for the tags on published articles.
How it works: - Reuses config/data.json and the existing functions in blog.ts.
- Includes published content and the corresponding search metadata.
- Adding a post or tag automatically updates the sitemap.
The generated sitemap is available at /sitemap.xml.
What do you think?
I thought that was pretty impressive.
The proposed code worked on the first try, and I had an automatically generated sitemap.
##What I changed in the rebuild
The remaking work I tackled this time includes the following.
- Redesign
- Migration to Next.js App Router
- Introducing Mantine
- Implementing Math Rendering with KaTeX in MDX
- PWA support
- Search indexing and social preview images
I put the most work into redesigning the site.
I spent the most time on the terminal-style welcome message on the home page.
I’d actually written that component more than two years earlier. For the rebuild I used it as the visual starting point for the rest of the site.
The other change I wanted was a migration to the Next.js App Router.
The App Router became stable in Next.js 13.4 and promised performance improvements over the Pages Router.
Because the two routers have different directory structures, I created a fresh project and moved the existing components into it.
We wanted to use various components implemented with Mantine, so we decided to develop based on the template introduced in the Mantine official documentation.
##Features in the new blog
###Rendering math in MDX
We implemented the functionality to display mathematical formulas in MDX using rehype-katex.
You can describe formulas within an MDX file as follows.
e^{i\theta} = \cos\theta + i\sin\theta
This will be displayed as follows.
###Search indexing and social preview images
We implemented various SEO measures based on the documentation at here.
The sitemap
I used the Next.js Metadata API in src/app/sitemap.ts to generate the sitemap.
By setting the frequency and priority of updates depending on the type of page, we provide the search engine crawlers with the appropriate information.
- Homepage: Updated Daily (Priority 1.0)
- Fixed Page: Weekly Update (Priority 0.8)
- Blog Post: Monthly Update (Priority 0.6)
- Tag Page: Weekly Update (Priority 0.4)
import { MetadataRoute } from 'next';
import { getAllPosts, getAllTags } from '@/lib/blog';
import { BASE_URL, SITEMAP_CHANGE_FREQ, SITEMAP_PRIORITY } from '@/lib/constants';
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
// Static page URLs
const staticPages = [
{
url: BASE_URL,
lastModified: new Date(),
changeFrequency: SITEMAP_CHANGE_FREQ.HOME,
priority: SITEMAP_PRIORITY.HOME,
},
{
url: `${BASE_URL}/about`,
lastModified: new Date(),
changeFrequency: SITEMAP_CHANGE_FREQ.STATIC_PAGE,
priority: SITEMAP_PRIORITY.STATIC_PAGE,
},
{
url: `${BASE_URL}/works`,
lastModified: new Date(),
changeFrequency: SITEMAP_CHANGE_FREQ.STATIC_PAGE,
priority: SITEMAP_PRIORITY.STATIC_PAGE,
},
{
url: `${BASE_URL}/posts`,
lastModified: new Date(),
changeFrequency: SITEMAP_CHANGE_FREQ.STATIC_PAGE,
priority: SITEMAP_PRIORITY.STATIC_PAGE,
},
{
url: `${BASE_URL}/tags`,
lastModified: new Date(),
changeFrequency: SITEMAP_CHANGE_FREQ.STATIC_PAGE,
priority: SITEMAP_PRIORITY.STATIC_PAGE,
},
];
// URLs of published articles
const posts = getAllPosts(false); // includeUnpublished = false
const postPages = posts.map((post) => ({
url: `${BASE_URL}/posts/${post.id}`,
lastModified: new Date(post.date),
changeFrequency: SITEMAP_CHANGE_FREQ.BLOG_POST,
priority: SITEMAP_PRIORITY.BLOG_POST,
}));
// Tag page URLs
const tags = getAllTags(false); // includeUnpublished = false
const tagPages = tags.map((tag) => ({
url: `${BASE_URL}/tags/${tag}`,
lastModified: new Date(),
changeFrequency: SITEMAP_CHANGE_FREQ.TAG_PAGE,
priority: SITEMAP_PRIORITY.TAG_PAGE,
}));
return [...staticPages, ...postPages, ...tagPages];
}
Crawler settings
The crawler rules live in src/app/robots.ts.
This setting restricts access to API endpoints while allowing appropriate crawling of content pages.
Additionally, I explicitly specify the URL for the sitemap.
import type { MetadataRoute } from 'next';
export default function robots(): MetadataRoute.Robots {
return {
rules: {
userAgent: '*',
allow: '/',
disallow: '/api/',
},
sitemap: 'https://hackfront.dev/sitemap.xml',
};
}
The RSS feed
I used the feed package in scripts/generate-feed.mjs to build the RSS feed from the blog posts.
When the build is executed, the generate-feed.mjs script is run, and a feed containing the following information is generated.
- The title and description of the article
- Posted Date
- Author Information
- The URL of the article
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import matter from 'gray-matter';
import { Feed } from 'feed';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const postsDirectory = path.join(__dirname, '../posts');
const siteData = JSON.parse(fs.readFileSync(path.join(__dirname, '../src/app/config/data.json'), 'utf8'));
function getAllPosts() {
const fileNames = fs.readdirSync(postsDirectory);
const allPostsData = fileNames
.filter((fileName) => fileName.endsWith('.mdx'))
.map((fileName) => {
const id = fileName.replace(/\.mdx$/, '');
const fullPath = path.join(postsDirectory, fileName);
const fileContents = fs.readFileSync(fullPath, 'utf8');
const { data } = matter(fileContents);
return {
id,
title: data.title,
date: data.date,
description: data.description,
tags: data.tags || [],
isPublished: data.isPublished ?? true,
};
})
.filter((post) => post.isPublished);
return allPostsData.sort((a, b) => (a.date < b.date ? 1 : -1));
}
async function generateFeed() {
const posts = getAllPosts();
const siteUrl = siteData.siteUrl;
const date = new Date();
const feed = new Feed({
title: siteData.title,
description: siteData.description,
id: siteUrl,
link: siteUrl,
language: 'ja',
image: `${siteUrl}/logo.svg`,
favicon: `${siteUrl}/favicon.ico`,
copyright: `All rights reserved ${date.getFullYear()}, ${siteData.author}`,
updated: date,
feedLinks: {
rss2: `${siteUrl}/feed.xml`,
},
author: {
name: siteData.author,
email: siteData.mail,
link: siteUrl,
},
});
posts.forEach((post) => {
const url = `${siteUrl}/posts/${post.id}`;
feed.addItem({
title: post.title,
id: url,
link: url,
description: post.description,
date: new Date(post.date),
author: [
{
name: siteData.author,
email: siteData.mail,
link: siteUrl,
},
],
});
});
fs.writeFileSync('./public/feed.xml', feed.rss2());
}
generateFeed().catch(console.error);
Dynamic Open Graph images
Info: Added on 2026/11/22
After that, we transitioned the delivery from Vercel to Cloudflare Workers and changed the configuration to statically render the entire site. As a result, we also stopped dynamic generation of OGP images at/api/ogand switched to the same design-based approach of generating images at build time (opengraph-image.tsx).
Therefore, the/api/ogURL mentioned below is currently unavailable. The images shown were generated before the migration.
This is the OGP image displayed when the article URL is shared on social media, but it is a task that requires quite a lot of effort to run a blog.
On platforms such as Qiita and Zenn, there is a feature that automatically generates OGP images based on the article title and posting date, but on your own blog, you definitely need to create them manually.
Therefore, this time we are implementing fast OGP (Open Graph Protocol) image generation using Edge Runtime (src/app/api/og/route.tsx is implemented).
We dynamically generate images with the following characteristics, keeping blog branding in mind.
- Adoption of a terminal-like design
- A highly readable expression using gradients
- Dynamic Embedding of Article Titles and Posting Dates
- 1200x630 pixel SNS optimization size
I use the next/og package for image generation.
By using the ImageResponse class in this package, you can convert HTML elements into images.
However, since this package internally uses the satori package, you need to be aware that there are limitations on the CSS properties that can be used.
Therefore, it seems that it would be quite difficult to implement it manually, but thanks to using Cline, we were able to replicate the same design as the components styled with TailwindCSS.
import { ImageResponse } from 'next/og';
import { NextRequest } from 'next/server';
import siteData from '../../config/data.json';
export const runtime = 'edge';
const WindowControls = () => (
<div style={{ display: 'flex', gap: '8px' }}>
<div
style={{
width: '12px',
height: '12px',
borderRadius: '9999px',
backgroundColor: '#ff5f56',
}}
/>
<div
style={{
width: '12px',
height: '12px',
borderRadius: '9999px',
backgroundColor: '#ffbd2e',
}}
/>
<div
style={{
width: '12px',
height: '12px',
borderRadius: '9999px',
backgroundColor: '#27c93f',
}}
/>
</div>
);
export async function GET(req: NextRequest) {
try {
const { searchParams } = new URL(req.url);
const title = searchParams.get('title') ?? siteData.title;
const date = searchParams.get('date');
const formatDate = (dateStr: string) => {
const date = new Date(dateStr);
const days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
const dayOfWeek = days[date.getDay()];
return `${dateStr} (${dayOfWeek})`;
};
return new ImageResponse(
(
<div
style={{
background: 'rgb(26, 27, 38)',
width: '100%',
height: '100%',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
padding: '40px',
}}
>
<div
style={{
background: 'linear-gradient(to bottom right, #8b5cf6, #ec4899)',
borderRadius: '8px',
width: '100%',
height: '100%',
padding: '1.5px',
display: 'flex',
}}
>
<div
style={{
borderRadius: '7px',
background: 'rgb(26, 27, 38)',
display: 'flex',
flexDirection: 'column',
width: '100%',
height: '100%',
}}
>
<div
style={{
borderTopLeftRadius: '8px',
borderTopRightRadius: '8px',
borderBottom: '1px solid rgb(36, 40, 59)',
background: 'rgb(26, 27, 38, 0.5)',
padding: '8px 16px',
fontSize: '14px',
color: 'rgb(169, 177, 214)',
display: 'flex',
flexDirection: 'column',
}}
>
<div
style={{
height: '20px',
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
}}
>
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
<WindowControls />
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
<svg
width="20"
height="20"
viewBox="0 0 10.583334 10.583334"
style={{ marginLeft: '12px', marginRight: '4px' }}
>
<path d="M 0.28397387,10.283974 1.5617015,2.3455284 3.3116258,1.1953993 Z" fill="#00ff00" />
<path
d="M 3.6672441,1.2365066 C 6.7110938,-1.0843383 8.2273756,1.7443967 10.283974,0.37314007 L 9.0965356,3.9864574 C 6.6443289,5.9107596 5.4034251,2.8745578 2.3481789,5.0166724 Z"
fill="#00ff00"
/>
</svg>
<span style={{ color: 'rgb(169, 177, 214)' }}>{siteData.title}</span>
</div>
</div>
</div>
</div>
<div
style={{
borderBottomLeftRadius: '8px',
borderBottomRightRadius: '8px',
flex: 1,
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
gap: '20px',
padding: '60px',
}}
>
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '12px' }}>
<div
style={{
fontSize: '48px',
fontWeight: 'bold',
background: 'linear-gradient(to right, #8b5cf6, #ec4899)',
backgroundClip: 'text',
color: 'transparent',
maxWidth: '800px',
textAlign: 'center',
}}
>
{title}
</div>
{date && (
<div
style={{
fontSize: '24px',
color: 'rgb(158, 206, 106)',
marginBottom: '8px',
}}
>
{formatDate(date)}
</div>
)}
<div
style={{
fontSize: '24px',
color: 'rgb(169, 177, 214)',
}}
>
{siteData.description}
</div>
</div>
</div>
</div>
</div>
</div>
),
{
width: 1200,
height: 630,
}
);
} catch (e: any) {
console.log(`${e.message}`);
return new Response(`Failed to generate the image`, {
status: 500,
});
}
}
In the OGP images for each article, by providing the article title and posting date as query parameters, we dynamically generate OGP images.
For example, visiting https://hackfront.dev/api/og?title=Sample%20title&date=2025-01-23 produces a preview image like this:

Please consider the Vercel resources and refrain from making excessive requests, but it's fine if you only try it a few times.
Please try it out.
##What worked and what took care
Through this remake work, several strengths and weaknesses of Cline have become apparent.
###Cline’s strengths
Coding in natural language
Cline's natural language coding feature is far better than you can imagine in terms of real-world usability.
For example, when given instructions such as "implement with a design similar to this file," Cline responds with a specific proposal within about 10 seconds.
As a human engineer, Cline immediately understands that it takes time to interpret a "similar design" and proposes implementation.
Also, if the proposal is different from the intention, you can make fine adjustments in the form of "Please correct this here like this".
What stands out is the high implementation capability based on official documentation.
By providing clear instructions and the latest documentation, Cline offers high-quality implementation.
This is particularly important in front-end development, where best practices are frequently updated, allowing for the reflection of the latest implementation techniques.
However, regarding the debate of whether engineers will be unnecessary due to Cline, there is, in reality, a need for different perspectives.
The role of humans in selecting and filtering information and providing appropriate instructions remains important, and the final quality of the product depends greatly on the user's technical understanding.
Choosing among language models
Cline allows you to use many LLM models.
In addition, the service I found particularly useful was the mediation service that connects you with various LLM models, "OpenRouter."
New models were coming out almost weekly. I wanted to try them without opening and funding a separate account with each provider.
OpenRouter let me try multiple models using one API key.
Furthermore, based on what I have tried so far, if we are using Cline at the moment, I have the impression that "anthropic/claude-3.5-sonnet:beta" is the strongest option.
I also tried using the recently trending "deepseek/deepseek-chat (DeepSeek V3)" tool, but the generation speed was quite slow and the output was often unstable.
However, it is undeniable that a price of 1/10 or less is attractive, so I look forward to improvements in the future.
###Things to watch for
One of the points to note about Cline is that basically there is only one thing: "the current cost is quite high."
Over three days of work with Cline, I spent about $55, or roughly ¥8,500 at ¥156 to the dollar.
Of course, there are parts where unnecessary costs were incurred before we had understood how to use it effectively, but when considering it as personal use, I felt it was a bit expensive.
I couldn’t have implemented that much on my own in three days, so it certainly saved me time.
Considering this, it is understandable that the DeepSeek V3, which can be realized at a cost of less than 1/10, is indeed attractive.
The main reason for Cline's increased cost is the increase in context due to the prolonged duration of the dialogue.
Cline enables consistent suggestions by providing all past interactions as context to the LLM.
The longer a conversation runs, though, the more each turn costs.
Summarizing, here are the things to keep in mind when using Cline.
Work on one feature at a time
The purpose of this is to make the length of a single interaction as short as possible.
When trying to implement multiple features at once, the instructions you give and the existing source code you need to review also increase.
Also, when trying to implement multiple features at once, it's difficult to verify that the generated code works correctly.
I think it's the same as regular coding, but it's important to clearly define the issue and give instructions to solve it only.
Point Cline to the existing code
Since Cline doesn't have context, when reviewing existing code, you need to indicate where that code is located.
Even without giving any specific instructions, Cline automatically highlights the area around the file name to check the content, but this results in unnecessary checking of a lot of code, which in turn increases the context.
Also, even though you want to use the components you have already implemented, you might accidentally create new components without realizing it.
In that sense, I still think it's essential that users also understand the software's structure, rather than completely relying on Cline for coding.
Commit often so you can discard an unsuccessful attempt
Since Cline incurs costs as the interaction becomes longer, it is important to discard the generated content and start over if the interaction does not work out.
In such cases, if you commit git commit regularly, you can revert to the original even if you discard it.
Since Cline can also execute code at the terminal, it sometimes reads the error message and makes a quick fix on its own, but it can also get stuck in a loop without success and repeatedly try mysterious fixes.
The most terrifying aspect is that costs continue to accumulate while you are doing nothing about it.
If, from the user's perspective, you no longer understand what policy they are following or what they are trying to fix, I think the LLM is probably trying to make corrections haphazardly without being able to organize the situation properly.
In such cases, it's also important to reset the interaction once and start over from scratch.
When resetting, it often helped to clearly state from the beginning what steps were incorrect, which often led to a quick resolution of the problem.
Also, it was quite effective for the user to search the web themselves and copy the methods to solve the problem.
###Another way I used Cline
Furthermore, what I plan to try in the future is to create work notes to help users and Cline develop a common understanding.
Specifically, prepare a note to record which file has what type of processing implemented, and make sure to verify it at the start of each interaction, and update that note once the coding is completed.
Cline has a feature called "Custom Instructions," and the instructions you set here can act as a system prompt.
Therefore, I believe that by outlining such instructions here, Cline will understand which files to review in order to fulfill the user's instructions, and that communication will proceed smoothly.
I will share the results once I actually try it out.
##Wrapping up
In this article, we shared our experience of recreating a technical blog using the AI coding tool "Cline".
Cline let me get much more done, though the cost is worth keeping an eye on.
How I framed each task and reviewed the result made a real difference to what I got out of the tool.
I hope these examples help if you’re deciding how to use Cline on your own project.