Key Features • How To Use • Deploy • Managing the Content • Credits • Support • License
I've been looking for a good, flexible template for SvelteKit / Tailwind CSS, but all the templates I found were either too simple, missing some needed features, or were too difficult to customize (or both). I loved Timothy Lin's simple but feature-rich Tailwind Nextjs Started Blog, so I decided to port that to SvelteKit, and add a few things I needed, including Netlify CMS, dynamic Open Graph image (og:image) support.
This is my first attempt to write something in SvelteKit. Most probably, I won't be maintaining this template much, and won't be adding features to it. Feel free to grab a copy and use it as you wish.
In order to use this template, you need to know the basics of SvelteKit + Tailwind CSS. Below is a quick note on how to install this, and where to look for changes and customizations.
# Clone this repository
$ git clone https://github.com/akiarostami/sveltekit-tailwind-blog-starter
# Go into the repository
$ cd sveltekit-tailwind-blog-starter
# Install dependencies
$ npm install
# Run the app
$ npm start
tailwind.config.cjs
and src/app.css
contain the tailwind stylesheet and the default css settings which can be modified to change the overall look and feel of the site.tailwind.config.cjs
src/app.css
src/lib/config.js
.env.example
Pre-rendering
is ON for all pages by default. You can change that from /src/routes/+layout.svelte
file by changing setting export const prerender = false;
.sr/lib/config.js
- contains most of the site related information which should be modified for a user's need.content
folder.static/img
folder.config.js
file.content/authors
folder. If you only have one user for your blog, you can set multiuser: false
in the config.js
file, and set the admin user into in the same file in the user
section.static/logo.svg
, static/logo.png
, static/favicon.ico
, and static/icon-xxx.png
with your own logo.routes
: read the SvelteKit documentation for all routing information.app.html
and linked from Google Fonts, and set in tailwind's config file. For a better site performance and ranking consider hosting your own fonts.src/lib/fonts
.markdown
is supported in all blog posts and project pages. Markdown configurations are set in mdsvex.config.js
file.rehype
and remark
Plugins can be used to extend the formatting.rehype-external-links
to open all content links in a new tab<youtube id="dQw4w9WgXcQ" title="The Best Cat Video Ever" />
.Follow Netlify's Documentation to deploy your site on Netlify, or Vercel's Documentation to deploy on Vercel Platform
As mentioned before, all content files (Blog Posts, Author Information, and Projects) are saved under the content
folder. These content types can simply be modified / extended / removed, and other content types can be added. For that, you can simply modify / add / remove markdown files in these folders.
Netlify CMS is not required for editing the content, but it would make life much easier. After setting up Netlify CMS, you can simply use yoursite.com/admin
to manage all your content from a simple web UI. Adding Netlify CMS is as easy as adding a couple of static files to your website. You can find these files under static/admin
, and can access the web interface from https://yoursite.com/admin
. You can simply delete this folder if you're not using Netlify CMS.
After deploying your site on Netlify:
Settings
> Identity
Services
section of that page, enable Git Gateway
Settings
> Registration
> Invite Only
Settings
> Identity
> Invite User
Accept the Invite
. It takes you to your site to a broken link. Add "/admin" to the domain and before "#invite_token"You're all set, and can access your site admin from yousite.com/admin
. You can also invite more users and editors from the same page (Settings
> Identity
> Invite User
);
Beside all the open-source packages used for this starter, I used or were inspired by the following:
Geoff Rich's Creative dynamic social card images with Svelte components
and of course, HBO's Silicon Valley
Support this template and effort by giving it a star on GitHub, sharing your own blog, and giving a shout-out on Twitter.