It's nice to have a cute interactive banner!
It's nice to have a cute interactive banner!
Welcome to the Distill Blog Template! This framework is based on the distill.pub design and has been adapted to make it easy for you to create beautiful, interactive technical blogs. Whether you're writing about machine learning, data science, physics, or any technical topic, this template provides the structure and components you need.
This template includes support for mathematics, interactive visualizations, citations, footnotes, and more. In this guide, we'll walk you through the structure of the template and how to customize it for your own blog.
The template is built with the following features in mind:
1. Beautiful typography and layout: The template follows Distill's clean, readable design principles with responsive layouts that work well on desktop and mobile.
2. Support for interactive components: You can include interactive visualizations, like the memory widget shown below:
Let's walk through how to use this template to create your own blog:
First, duplicate the repository and clone it to your local machine and install the dependencies:
To run the development server:
This will start a local server at http://localhost:8080
where you can preview your blog as you edit it.
The front matter contains metadata about your blog post, such as the title, description, and author information. Edit the <d-front-matter>
section at the top of src/index.html
:
An the corresponding entries in src/distill.js
in the bylineTemplate
.
Your main content goes within the <d-article>
tags. You can use standard HTML tags with some special Distill components:
You can include inline math using <d-math>x^2 + y^2 = z^2</d-math>
which renders as
For block equations, use <d-math block>E = mc^2</d-math>
:
It's great to include code samples in your blog post. In-line you can do it via the <code>
tags. For code blocks you can use the <d-code block language="clike">
tags. Take the for example the following block:
It will render as:
Finally, if you want to include code from GitHub you can use emgithub.com and for example create a collapsable widget like this:
Which will display as follows:
You can include side notes using the <aside>...</aside>
tag:
Include figures with captions:
This will show the following:
You can easily add tables with the default HTML formatting:
This will render as a table as expected:
Model | Accuracy | Speed |
---|---|---|
Model A | 95% | Fast |
Model B | 98% | Medium |
Model C | 99% | Slow |
Citations can be included using <d-cite bibtex-key="example2023"></d-cite>
tags and a separate bibliography file:
As shown in the paper
When you're ready to build your blog for production:
npm run build
This will create optimized files in the dist/
directory. You can then commit and push the changes back to the space and see the result.
You can for example include interactive Plotly visualizations in your blog by creating HTML fragments:
To generate these charts, run the included Python script:
This creates HTML fragments in the src/fragments/
directory that you can include in your blog using the id
attribute matching the fragment name.
This template supports HTML fragments, which are useful for including complex visualizations or interactive components:
src/fragments/
directory, e.g., src/fragments/my-visualization.html
{{{fragment-my-visualization}}}
Fragments can contain HTML, CSS, and JavaScript. They're loaded asynchronously, which helps keep your main document lightweight.
You can customize the appearance of your blog by editing src/style.css
. The template uses CSS variables for colors, fonts, and spacing, making it easy to adjust the overall look and feel.
For interactive components, add your JavaScript code to src/index.js
or create new modules and import them. The template uses webpack to bundle JavaScript files.
Edit src/bibliography.bib
to include your citations in BibTeX format.
This template gives you everything you need to create beautiful, interactive technical blogs. By combining clear writing with interactive visualizations and mathematical notation, you can effectively communicate complex ideas to your audience.
For more examples and inspiration, visit distill.pub.
For attribution in academic contexts, please cite this work as
"The Distill Blog Template", 2025.
BibTeX citation
@misc{distill_blog_template, title={The Distill Blog Template}, author={Some Authors et al}, year={2025}, }