Blogger Theme Creation Guide
This beginner's guide to creating a Blogger theme covers the basic structure of XML code used in Blogger, as well as how to customize CSS to create a beautiful and responsive blog design. It also introduces key elements such as the header, content, sidebar, and footer, along with examples of how to use various widgets in Blogger, making it easier for readers to understand and apply them to their own theme development.
Make a “Really Empty” Blank Page with HTML
1. Code Blogger theme blank blogger blank page
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
<head>
<meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible'/>
<b:if cond='data:blog.isMobile'>
<meta content='width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0' name='viewport'/>
<b:else/>
<meta content='width=1100' name='viewport'/>
</b:if>
<b:include data='blog' name='all-head-content'/>
<title><data:blog.pageTitle/></title>
<b:skin>
<![CDATA[/*
----- css Yours here -----
]]>
</b:skin>
</head>
<body>
<b:section class='main' id='main' showaddelement='yes'/>
<!-- Please Keep The Credits -->
<center><a href="//siammakemoney.com/">siammakemoney.com/</a></center>
</body>
</html>
—– css Yours here —– Enter your css here.
Explain basic code
This code is The most basic structure of the Blogger theme together with:
- Blogger HTML + namespace layout
- Meta for mobile/desktop
- Retrieving blog data such as page names
- Area for inserting CSS
- One section for inserting widgets
- Add credit below
Simple and easy to use for creating minimal Blogger templates.
✔ This section is for declaring XML and defining namespaces.
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns='http://www.w3.org/1999/xhtml'
xmlns:b='http://www.google.com/2005/gml/b'
xmlns:data='http://www.google.com/2005/gml/data'
xmlns:expr='http://www.google.com/2005/gml/expr'>
xmlns:b= Used for Blogger tags such as:<b:if>,<b:section>xmlns:data= Used to extract data from blogs such asdata:blog.pageTitlexmlns:expr= Used to process various expressions.
✔ Set Internet Explorer to display like IE7
<head>
<meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible'/>
✔ Set split screen size for mobile / desktop
<b:if cond='data:blog.isMobile'>
<meta content='width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0' name='viewport'/>
<b:else/>
<meta content='width=1100' name='viewport'/>
</b:if>
- If it's a mobile phone → use a responsive viewport.
- If it is a desktop → set the width to 1100px.
✔ Tell Blogger to include content <head> Blogger Standards
<b:include data='blog' name='all-head-content'/>
- Such as automatic scripts, various meta tags
✔ Name the web page from the blog page name.
<title><data:blog.pageTitle/></title>
- Use the data that Blogger automatically generates for you.
✔ Section for inserting theme CSS
<b:skin>
<![CDATA[/*
----- css Yours here -----
]]>
</b:skin>
<![CDATA[ ]]>= Used to insert code that cannot be directly processed by XML, such as CSS.
✔ Blogger's main content display section
</head>
<body>
<b:section class='main' id='main' showaddelement='yes'/>
<b:section>This is the section where we can add widgets.showaddelement='yes'= Allows you to add gadgets to the layout.
✔ Close HTML structure
</body>
</html>
2. Blogger theme (no sidebar)
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns='http://www.w3.org/1999/xhtml'
xmlns:b='http://www.google.com/2005/gml/b'
xmlns:data='http://www.google.com/2005/gml/data'
xmlns:expr='http://www.google.com/2005/gml/expr'>
<head>
<meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible'/>
<b:if cond='data:blog.isMobile'>
<meta content='width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0' name='viewport'/>
<b:else/>
<meta content='width=device-width, initial-scale=1.0' name='viewport'/>
</b:if>
<b:include data='blog' name='all-head-content'/>
<title><data:blog.pageTitle/></title>
<link href='https://fonts.googleapis.com/css2?family=Kanit:wght@400;600&display=swap' rel='stylesheet'/>
<b:skin><![CDATA[
/* Reset */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Kanit', sans-serif;
background: #f7f9fc;
color: #333;
line-height: 1.6;
}
a {
color: inherit;
text-decoration: none;
transition: color 0.3s;
}
a:hover {
color: #008f7a;
}
header {
background: #ffffff;
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
padding: 15px 30px;
position: sticky;
top: 0;
z-index: 100;
display: flex;
align-items: center;
justify-content: space-between;
}
header h1 {
font-size: 1.5rem;
font-weight: 600;
color: #008f7a;
}
nav ul {
list-style: none;
display: flex;
gap: 20px;
}
nav li {
font-weight: 500;
}
.container {
max-width: 1100px;
margin: 30px auto;
padding: 0 15px;
}
/* Blog Post Card */
.post-card {
background: #fff;
border-radius: 16px;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 4px 12px rgba(0,0,0,0.05);
transition: transform 0.3s;
}
.post-card:hover {
transform: translateY(-4px);
}
.post-card h2 {
font-size: 1.4rem;
margin-bottom: 10px;
color: #222;
}
.post-card p {
color: #666;
font-size: 1rem;
}
/* Footer */
footer {
background: #222;
color: #eee;
text-align: center;
padding: 20px;
margin-top: 40px;
}
]]></b:skin>
</head>
<body>
<!-- Header -->
<header>
<h1><data:blog.title/></h1>
<nav>
<ul>
<li><a expr:href='data:blog.homepageUrl'>Home</a></li>
<li><a href='#'>About</a></li>
<li><a href='#'>Contact</a></li>
</ul>
</nav>
</header>
<!-- Content -->
<div class="container">
<b:section id='main' class='main' showaddelement='yes'>
<b:widget id='Blog1' type='Blog' title='Blog Posts' visible='true'/>
</b:section>
</div>
<!-- Footer -->
<footer>
<p>© <data:blog.title/> - Powered by Blogger</p>
<p><a href='//siammakemoney.com' style='color:#00c9a7;'>siammakemoney.com</a></p>
</footer>
</body>
</html>
<!-- Content -->
<div class="container">
<b:section id='main' class='main' showaddelement='yes'>
<b:widget id='Blog1' type='Blog' title='Blog Posts' visible='true'/>
</b:section>
</div>
<!– Header –> ส่วนหัวเมนู
<!– Content –> ส่วนนี้คือการดึงโพสมาแสดง
<!– Footer –> ส่วนท้าย
🧱 Website top (Header)
<header>
<h1><data:blog.title/></h1>
<nav>
<ul>
<li><a expr:href='data:blog.homepageUrl'>Home</a></li>
<li><a href='#'>About</a></li>
<li><a href='#'>Contact</a></li>
</ul>
</nav>
</header>
📰 Content Section
<div class="container">
<b:section id='main' class='main' showaddelement='yes'>
<b:widget id='Blog1' type='Blog' title='Blog Posts' visible='true'/>
</b:section>
</div>
Content section How does it work?
<b:section>= Widget area (arranged through Layout in Blogger)<b:widget type="Blog">= Show Blogger posts- Blogger will generate internal HTML such as:
- Home page posts list
- Full article on the post page
<footer>
<p>© <data:blog.title/> - Powered by Blogger</p>
<p><a href='//siammakemoney.com'>siammakemoney.com</a></p>
</footer>
2.1 Structure in various Bloggers
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns='http://www.w3.org/1999/xhtml'
xmlns:b='http://www.google.com/2005/gml/b'
xmlns:data='http://www.google.com/2005/gml/data'
xmlns:expr='http://www.google.com/2005/gml/expr'>
<head>
<!-- meta, title, CSS/JS -->
</head>
<body>
<!-- header -->
<!-- navigation -->
<!-- main content -->
<!-- sidebar -->
<!-- footer -->
</body>
</html>
<b:section class='header' id='header' maxwidgets='1' showaddelement='no'>
<b:widget id='Header1' locked='true' title='Header' type='Header'/>
</b:section>
<b:section class='content' id='content' showaddelement='yes'>
<b:widget id='Blog1' type='Blog' title='Blog Posts'/>
</b:section>
<b:section class='sidebar' id='sidebar' showaddelement='yes'>
<b:widget id='Profile1' type='Profile' title='About Me'/>
</b:section>
<b:section class='footer' id='footer' showaddelement='yes'>
<b:widget id='Attribution1' type='Attribution' title=''/>
</b:section>
2.2 Add a Blogger title
<title><data:blog.pageTitle/></title>
3. Theme adds sidebar gadgets/widgets.
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns='http://www.w3.org/1999/xhtml'
xmlns:b='http://www.google.com/2005/gml/b'
xmlns:data='http://www.google.com/2005/gml/data'
xmlns:expr='http://www.google.com/2005/gml/expr'>
<head>
<meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible'/>
<b:if cond='data:blog.isMobile'>
<meta content='width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0' name='viewport'/>
<b:else/>
<meta content='width=device-width, initial-scale=1.0' name='viewport'/>
</b:if>
<b:include data='blog' name='all-head-content'/>
<title><data:blog.pageTitle/></title>
<link href='https://fonts.googleapis.com/css2?family=Kanit:wght@400;600&display=swap' rel='stylesheet'/>
<b:skin><![CDATA[
body {
font-family: 'Kanit', sans-serif;
background: #f7f9fc;
color: #333;
line-height: 1.6;
margin: 0;
}
a { text-decoration: none; color: inherit; }
header {
background: #fff;
padding: 15px 30px;
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
position: sticky;
top: 0;
z-index: 100;
display: flex;
justify-content: space-between;
align-items: center;
}
header h1 { color: #008f7a; font-size: 1.5rem; }
nav ul { display: flex; gap: 20px; list-style: none; }
nav li { font-weight: 500; }
.container {
display: grid;
grid-template-columns: 2fr 1fr; /* Main 2 ส่วน / Sidebar 1 ส่วน */
gap: 20px;
max-width: 1200px;
margin: 30px auto;
padding: 0 15px;
}
/* Post card */
.post-card {
background: #fff;
border-radius: 12px;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 4px 12px rgba(0,0,0,0.05);
transition: transform 0.3s;
}
.post-card:hover { transform: translateY(-4px); }
.post-card h2 { font-size: 1.3rem; margin-bottom: 10px; }
.post-card p { color: #666; }
/* Sidebar */
.sidebar {
background: #fff;
border-radius: 12px;
padding: 20px;
box-shadow: 0 4px 12px rgba(0,0,0,0.05);
height: fit-content;
}
.sidebar h3 { font-size: 1.2rem; margin-bottom: 15px; color: #008f7a; }
/* Footer */
footer {
background: #222;
color: #eee;
text-align: center;
padding: 20px;
margin-top: 40px;
}
]]></b:skin>
</head>
<body>
<!-- Header -->
<header>
<h1><data:blog.title/></h1>
<nav>
<ul>
<li><a expr:href='data:blog.homepageUrl'>Home</a></li>
<li><a href='#'>About</a></li>
<li><a href='#'>Contact</a></li>
</ul>
</nav>
</header>
<!-- Content -->
<div class="container">
<!-- Main -->
<main>
<b:section id='main' class='main' showaddelement='yes'>
<b:widget id='Blog1' type='Blog' title='Blog Posts' visible='true'/>
</b:section>
</main>
<!-- Sidebar -->
<aside class="sidebar">
<h3>Gadgets</h3>
<b:section id='sidebar' class='sidebar-widgets' showaddelement='yes'/>
</aside>
</div>
<!-- Footer -->
<footer>
<p>© <data:blog.title/> - Powered by Blogger</p>
<p><a href='//siammakemoney.com' style='color:#00c9a7;'>siammakemoney.com</a></p>
</footer>
<!-- Back to top -->
<button id="back-to-top" class="back-to-top">↑</button>
</body>
</html>
Sidebar Gadgets/Widgets In Blogger theme we need to add <b:section> Keep in <body> Beside main (Post display section)
✅ 3.1. XML declaration and namespace section
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns='http://www.w3.org/1999/xhtml'
xmlns:b='http://www.google.com/2005/gml/b'
xmlns:data='http://www.google.com/2005/gml/data'
xmlns:expr='http://www.google.com/2005/gml/expr'>
explain
<?xml ...?>→ It says it is an XML file that Blogger uses to convert to HTML.xmlns:b→ Used for Blogger tags such as:<b:section>,<b:widget>xmlns:data→ Used to extract data such as<data:blog.title/>xmlns:expr→ Use to insert expressions such asexpr:href='data:blog.url'
✅ 3.2. <head> Website header
3.2.1 Supports older Internet Explorer
<meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible'/>
3.2.2 Mobile/Desktop Viewport
<b:if cond='data:blog.isMobile'>
<meta content='width=device-width,initial-scale=1.0,...' name='viewport'/>
<b:else/>
<meta content='width=device-width, initial-scale=1.0' name='viewport'/>
</b:if>
How does it work?
- If you access the website on your mobile phone → use the mobile friendly viewport.
- If it is a desktop → use full screen.
3.2.3 Auto-load Blogger header
<b:include data='blog' name='all-head-content'/>
together with:
- Article meta
- Open Graph
- Basic Schema
- Feed
Very important, do not delete.
3.2.4 Pull the page name as <title>
<title><data:blog.pageTitle/></title>
3.2.5 Load Google Fonts
<link href="https://fonts.googleapis.com/css2?family=Kanit..." />
🎨3.3 All CSS (inside <b:skin>)
<b:skin><![CDATA[
... CSS ...
]]></b:skin>
Blogger must include CSS inside. <b:skin> only
🧱 4. Website Header
<header>
<h1><data:blog.title/></h1>
<nav>
<ul>
<li><a expr:href='data:blog.homepageUrl'>Home</a></li>
<li><a href='#'>About</a></li>
<li><a href='#'>Contact</a></li>
</ul>
</nav>
</header>
explain
<data:blog.title/>→ Blog name- Menu arranged from left to right
- CSS Sticky Header
📰 5. Content Container Layout
<div class="container">
<main>
<b:section id='main'>
<b:widget type='Blog'/>
</b:section>
</main>
<aside class="sidebar">
<h3>Gadgets</h3>
<b:section id='sidebar'/>
</aside>
</div>
5.1 Main Content
<b:widget type='Blog' />
It is the heart of Blogger.
show:
- Post list
- Full article
- pagination
5.2 Sidebar
<b:section id='sidebar' ... />
You can add widgets from the layout such as:
- Popular Posts
- HTML/JavaScript
- Labels
- Ads
<footer>
<p>© <data:blog.title/> - Powered by Blogger</p>
<p><a href="//siammakemoney.com">...</a></p>
</footer>
explain
- Automatically retrieve the year and name of the blog
- Add credit
- The background color is black.
⬆️ 7. Back-to-Top Button
<button id="back-to-top" class="back-to-top">↑</button>
Usually, there must be some JS as well, such as:
window.addEventListener('scroll', () => {
document.getElementById('back-to-top').style.display =
window.scrollY > 300 ? 'block' : 'none';
});
document.getElementById('back-to-top').onclick = () =>
window.scrollTo({ top: 0, behavior: 'smooth' });
| part | Doing what? |
|---|---|
| XML Namespace | Enable Blogger tags |
| Viewport | Responsive |
| all-head-content | SEO + Meta auto from Blogger |
| CSS | Design the entire layout |
| Header | Logo + Menu |
| Container | 2-column grid |
| Blog1 | Show blog posts |
| Sidebar | Place widgets as desired. |
| Footer | Copyright notice |
| Back-to-Top | Back button |
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns='http://www.w3.org/1999/xhtml'
xmlns:b='http://www.google.com/2005/gml/b'
xmlns:data='http://www.google.com/2005/gml/data'
xmlns:expr='http://www.google.com/2005/gml/expr'>
<head>
<meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible'/>
<b:if cond='data:blog.isMobile'>
<meta content='width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0' name='viewport'/>
<b:else/>
<meta content='width=device-width, initial-scale=1.0' name='viewport'/>
</b:if>
<b:include data='blog' name='all-head-content'/>
<title><data:blog.pageTitle/></title>
<link href='https://fonts.googleapis.com/css2?family=Kanit:wght@400;600&display=swap' rel='stylesheet'/>
<b:skin><![CDATA[
body {
font-family: 'Kanit', sans-serif;
background: #f7f9fc;
color: #333;
line-height: 1.6;
margin: 0;
}
a { text-decoration: none; color: inherit; }
a:hover { color: #008f7a; }
header {
background: #fff;
padding: 15px 30px;
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
position: sticky;
top: 0;
z-index: 100;
display: flex;
justify-content: space-between;
align-items: center;
}
header h1 { color: #008f7a; font-size: 1.5rem; }
nav ul { display: flex; gap: 20px; list-style: none; }
nav li { font-weight: 500; }
.container {
display: grid;
grid-template-columns: 300px 1fr; /* Sidebar 300px / Main content flexible */
gap: 20px;
max-width: 1200px;
margin: 30px auto;
padding: 0 15px;
}
/* Post card */
.post-card {
background: #fff;
border-radius: 12px;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 4px 12px rgba(0,0,0,0.05);
transition: transform 0.3s;
}
.post-card:hover { transform: translateY(-4px); }
.post-card h2 { font-size: 1.3rem; margin-bottom: 10px; }
.post-card p { color: #666; }
/* Sidebar */
.sidebar {
background: #fff;
border-radius: 12px;
padding: 20px;
box-shadow: 0 4px 12px rgba(0,0,0,0.05);
height: fit-content;
}
.sidebar h3 { font-size: 1.2rem; margin-bottom: 15px; color: #008f7a; }
/* Footer */
footer {
background: #222;
color: #eee;
text-align: center;
padding: 20px;
margin-top: 40px;
}
/* Back to top */
.back-to-top {
position: fixed;
bottom: 20px;
right: 20px;
background: #008f7a;
color: #fff;
border: none;
border-radius: 50%;
width: 50px;
height: 50px;
font-size: 20px;
cursor: pointer;
display: none;
align-items: center;
justify-content: center;
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.back-to-top:hover {
background: #006f5a;
}
/* Responsive */
@media screen and (max-width: 900px) {
.container {
grid-template-columns: 1fr;
}
.sidebar { margin-bottom: 20px; }
}
]]></b:skin>
</head>
<body>
<!-- Header -->
<header>
<h1><data:blog.title/></h1>
<nav>
<ul>
<li><a expr:href='data:blog.homepageUrl'>Home</a></li>
<li><a href='#'>About</a></li>
<li><a href='#'>Contact</a></li>
</ul>
</nav>
</header>
<!-- Container: Sidebar + Main -->
<div class="container">
<!-- Sidebar -->
<aside class="sidebar">
<h3>Menu & Gadgets</h3>
<b:section id='sidebar' class='sidebar-widgets' showaddelement='yes'/>
</aside>
<!-- Main content -->
<main>
<b:section id='main' class='main' showaddelement='yes'>
<b:widget id='Blog1' type='Blog' title='Blog Posts' visible='true'/>
</b:section>
</main>
</div>
<!-- Footer -->
<footer>
<p>© <data:blog.title/> - Powered by Blogger</p>
<p><a href='//siammakemoney.com' style='color:#00c9a7;'>siammakemoney.com</a></p>
</footer>
<!-- Back to top -->
<button id="back-to-top" class="back-to-top">↑</button>
<script>
const btn = document.getElementById('back-to-top');
window.addEventListener('scroll', () => {
btn.style.display = window.scrollY > 200 ? 'flex' : 'none';
});
btn.addEventListener('click', () => {
window.scrollTo({ top: 0, behavior: 'smooth' });
});
</script>
</body>
</html>
<!– Sidebar (ซ้าย) –>
<!– Main content (ขวา) –>
🔷 Overview of the code in this theme
This is 2-column Blogger template (Sidebar + Main) With:
- Header sticky
- Sidebar fixed width (300px)
- Main content flexible
- Post card design
- Footer
- Back-to-top button
- Responsive layout
- Pull post through
<b:widget type="Blog">
🔶 4.1. XML declaration and namespace section
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns='http://www.w3.org/1999/xhtml'
xmlns:b='http://www.google.com/2005/gml/b'
xmlns:data='http://www.google.com/2005/gml/data'
xmlns:expr='http://www.google.com/2005/gml/expr'>
✔ Explain
This is The main structure that bloggers must use:
| namespace | duty |
|---|---|
b: | Use Blogger's system tags such as: <b:section>, <b:widget> |
data: | Pull data such as <data:blog.title/> |
expr: | Writing expressions such as: expr:href="data:blog.homepageUrl" |
🔶 4.2. <head> — Web header
✔4.2.1 Viewport for mobile
<b:if cond='data:blog.isMobile'>
<meta content="width=device-width, initial-scale=1.0" />
<b:else/>
<meta content="width=device-width, initial-scale=1.0" />
</b:if>
✔ 4.2.2 Add Blogger's auto-generated meta and scripts
<b:include data='blog' name='all-head-content'/>
Blogger will automatically add the following:
- Title / Description of the page
- OpenGraph
- Article Schema
- Canonical URL
- Feed
- CSS widget
It is an important part, do not delete it.
✔ 4.2.3 Page Title
<title><data:blog.pageTitle/></title>
Pull names by page, such as:
- Home → Blog Name
- Post display page → Post name
- Page with label → Label name
✔ 4.2.4 Download Google Fonts
<link href="https://fonts.googleapis.com/css2?family=Kanit..." />
Set the font across the site
🔶 4.3. <b:skin> — CSS section of the template
Blogger must include all CSS inside <b:skin><![CDATA[ ... ]]></b:skin>
✔ 4.3.1 Define the main style of the website.
body {
font-family:'Kanit';
background:#f7f9fc;
color:#333;
}
Set background color, font, text color
✔ 4.3.2 Header Sticky
header {
position:sticky;
top:0;
background:#fff;
box-shadow:0 2px 8px rgba(0,0,0,0.05);
}
When scrolling → Header is attached to the top
nav ul {
display:flex;
gap:20px;
list-style:none;
}
Horizontal menu with Flexbox
✔ 4.3.4 2-column layout structure
.container {
display:grid;
grid-template-columns: 300px 1fr;
gap:20px;
}
| column | Width |
|---|---|
| Sidebar | Fixed 300px |
| Main content | 1fr (fully stretchable) |
✔ 4.3.5 Post Card (for article list)
.post-card {
background:#fff;
border-radius:12px;
padding:20px;
box-shadow:0 4px 12px rgba(0,0,0,0.05);
}
Create beautiful postcards
✔ 4.3.6 Sidebar Box
.sidebar {
background:#fff;
border-radius:12px;
padding:20px;
}
Sidebar has a card-like style.
footer {
background:#222;
color:#eee;
text-align:center;
}
✔ 4.3.8 Back-to-top button
.back-to-top {
position:fixed;
bottom:20px;
right:20px;
background:#008f7a;
width:50px;
height:50px;
border-radius:50%;
display:none;
}
Hide the buttons for now.
✔4.3.9 Responsive Mobile
@media (max-width:900px) {
.container {
grid-template-columns:1fr;
}
}
Mobile → Change to 1 column
🔶 4.4 parts <body>
✔ Header
<header>
<h1><data:blog.title/></h1>
<nav>
<ul>
<li><a expr:href='data:blog.homepageUrl'>Home</a></li>
Pull the blog name to display
✔ Layout: Sidebar + Main
<div class="container">
📌 Sidebar
<aside class="sidebar">
<b:section id='sidebar'/>
</aside>
is Widget Placement Area such as:
- Popular post
- Label
- HTML/JS
- Profile
Users added via Blogger's Layout page
📌 Main Content
<main>
<b:section id='main'>
<b:widget type='Blog'/>
</b:section>
</main>
This is the heart of the template.
Display:
- Post list
- Full article
- picture
- Pagination
- Comment form
<footer>
© <data:blog.title/>
</footer>
✔ Back-to-top Button + Script
button
<button id="back-to-top" class="back-to-top">↑</button>
Working Script
window.addEventListener('scroll', () => {
btn.style.display = window.scrollY > 200 ? 'flex' : 'none';
});
Condition: Scroll down > 200px → Show button
btn.addEventListener('click', () => {
window.scrollTo({ top: 0, behavior: 'smooth' });
});
When clicked → smooth scroll back to the top
✨ Summary of what this code does
| part | How does it work? |
|---|---|
| XML Namespace | Enable Blogger tags |
| Viewport | Make a responsive website |
| all-head-content | Automatic SEO meta |
| Header | Sticky + Navigation |
| Container | 2-column grid layout |
| Sidebar | Place widgets from the Layout page |
| Main section | Automatically display blog posts |
| CSS | Design the entire UI |
| Responsive | Optimized layout for mobile |
| Back-to-top | Auto scroll up button |
5. Blogger Full Features Sidebar Left and Right
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns='http://www.w3.org/1999/xhtml'
xmlns:b='http://www.google.com/2005/gml/b'
xmlns:data='http://www.google.com/2005/gml/data'
xmlns:expr='http://www.google.com/2005/gml/expr'>
<head>
<meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible'/>
<b:if cond='data:blog.isMobile'>
<meta content='width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0' name='viewport'/>
<b:else/>
<meta content='width=1200, initial-scale=1.0' name='viewport'/>
</b:if>
<b:include data='blog' name='all-head-content'/>
<title><data:blog.pageTitle/></title>
<link href='https://fonts.googleapis.com/css2?family=Kanit:wght@400;600&display=swap' rel='stylesheet'/>
<b:skin><![CDATA[
/* ---------- Variables ---------- */
:root {
--primary-color: #008f7a;
--layout-max-width: 1200px;
--sidebar-width: 250px;
}
/* ---------- Reset ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'Kanit', sans-serif;
background: #f7f9fc;
color: #333;
line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
a:hover { color: var(--primary-color); }
header {
background: #fff;
padding: 15px 30px;
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
position: sticky;
top: 0;
z-index: 100;
display: flex;
justify-content: space-between;
align-items: center;
}
header h1 { color: var(--primary-color); font-size: 1.5rem; }
nav ul { display: flex; gap: 20px; list-style: none; }
nav li { font-weight: 500; }
/* ---------- Layout ---------- */
.container {
display: grid;
grid-template-columns: var(--sidebar-width) 1fr var(--sidebar-width);
gap: 20px;
max-width: var(--layout-max-width);
margin: 30px auto;
padding: 0 15px;
}
main { display: flex; flex-direction: column; }
.post-card {
background: #fff;
border-radius: 12px;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 4px 12px rgba(0,0,0,0.05);
transition: transform 0.3s;
}
.post-card:hover { transform: translateY(-4px); }
.post-card h2 { font-size: 1.3rem; margin-bottom: 10px; }
.post-card p { color: #666; }
/* ---------- Sidebar ---------- */
.sidebar {
background: #fff;
border-radius: 12px;
padding: 20px;
box-shadow: 0 4px 12px rgba(0,0,0,0.05);
height: fit-content;
}
.sidebar h3 { font-size: 1.2rem; margin-bottom: 15px; color: var(--primary-color); }
/* ---------- Footer ---------- */
footer {
background: #222;
color: #eee;
text-align: center;
padding: 20px;
margin-top: 40px;
}
/* ---------- Back to Top ---------- */
.back-to-top {
position: fixed;
bottom: 20px;
right: 20px;
background: var(--primary-color);
color: #fff;
border: none;
border-radius: 50%;
width: 50px;
height: 50px;
font-size: 20px;
cursor: pointer;
display: none;
align-items: center;
justify-content: center;
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.back-to-top:hover { background: darken(var(--primary-color), 10%); }
/* ---------- Responsive ---------- */
@media screen and (max-width: 1200px) {
.container { grid-template-columns: 200px 1fr 200px; }
}
@media screen and (max-width: 900px) {
.container { grid-template-columns: 1fr; }
.sidebar { margin-bottom: 20px; }
}
]]></b:skin>
</head>
<body>
<!-- Header -->
<header>
<h1><data:blog.title/></h1>
<nav>
<ul>
<li><a expr:href='data:blog.homepageUrl'>Home</a></li>
<li><a href='#'>About</a></li>
<li><a href='#'>Contact</a></li>
</ul>
</nav>
</header>
<!-- Container: Left Sidebar + Main + Right Sidebar -->
<div class="container">
<!-- Left Sidebar -->
<aside class="sidebar">
<h3>Left Menu</h3>
<b:section id='left-sidebar' class='sidebar-widgets' showaddelement='yes'/>
</aside>
<!-- Main Content -->
<main>
<b:section id='main' class='main' showaddelement='yes'>
<b:widget id='Blog1' type='Blog' title='Blog Posts' visible='true'/>
</b:section>
</main>
<!-- Right Sidebar -->
<aside class="sidebar">
<h3>Right Menu</h3>
<b:section id='right-sidebar' class='sidebar-widgets' showaddelement='yes'/>
</aside>
</div>
<!-- Footer -->
<footer>
<p>© <data:blog.title/> - Powered by Blogger</p>
<p><a href='//siammakemoney.com' style='color:#00c9a7;'>siammakemoney.com</a></p>
</footer>
<!-- Back to Top -->
<button id="back-to-top" class="back-to-top">↑</button>
<script>
const btn = document.getElementById('back-to-top');
window.addEventListener('scroll', () => {
btn.style.display = window.scrollY > 200 ? 'flex' : 'none';
});
btn.addEventListener('click', () => {
window.scrollTo({ top: 0, behavior: 'smooth' });
});
</script>
</body>
</html>
–primary-color: #008f7a; /* Primary color, editable /
–layout-max-width: 1200px; / Adjust layout width /
–sidebar-width: 250px; / Sidebar width */
6. Delete the bullet (period in front).
- (bullet point like this)
ul, ol {
list-style: none !important;
padding-left: 0 !important;
margin-left: 0 !important;
}
7. Add a simple 20×20 px image.
<img src="https://example.com/icon.png" alt="icon" width="20" height="20">
8. Add Font Awesome icons easily.
8.1 Add Font Awesome CDN (if not already available)
<link href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css' rel='stylesheet'/>
8.2 Add Font Awesome icon and resize it.
<i class="fa-solid fa-house" style="font-size:20px;"></i>
8.2 Add color to Font Awesome icons
<style>
.icon-small {
font-size: 20px;
color: #000; /* เปลี่ยนสีไอคอนได้ */
}
</style>
<i class="fa-solid fa-heart icon-small"></i>
&
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
<head>
<meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible'/>
<b:if cond='data:blog.isMobile'>
<meta content='width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0' name='viewport'/>
<b:else/>
<meta content='width=1100' name='viewport'/>
</b:if>
<b:include data='blog' name='all-head-content'/>
<title><data:blog.pageTitle/></title>
<b:skin><![CDATA[
/* Reset body */
body {
margin: 0;
height: 10vh;
display: flex;
justify-content: center;
align-items: center;
background-color: #f4f4f4; /* สีพื้นหลัง */
}
/* Container เมนู */
.radio-inputs {
position: relative;
display: flex;
border-radius: 1rem;
background-image: linear-gradient(to right, #31c7c1, #499b87, #4a715b, #3d4a3b, #262724);
box-sizing: border-box;
font-size: 17px;
width: 80%;
padding: 1rem 1rem 0 1rem;
}
/* ซ่อน radio จริง */
.radio-inputs .radio input {
display: none;
}
/* ปุ่มเมนู */
.radio-inputs .radio .name {
display: flex;
cursor: pointer;
align-items: center;
justify-content: center;
border-top-left-radius: 0.5rem;
border-top-right-radius: 0.5rem;
border: none;
padding: 0.5rem 0.8rem;
color: #fff;
transition: all 0.15s ease-in-out;
position: relative;
}
/* ปุ่มที่ถูกเลือก */
.radio-inputs .radio input:checked + .name {
background-color: #FFFFFF;
font-weight: 600;
color: #000;
}
/* Hover */
.radio-inputs .radio input + .name:hover {
color: #fff;
}
.radio-inputs .radio input:checked + .name:hover {
color: #000;
}
/* มุมโค้งสวย ๆ เวลาเลือก */
.radio-inputs .radio input:checked + .name::after,
.radio-inputs .radio input:checked + .name::before {
content: "";
position: absolute;
width: 10px;
height: 10px;
bottom: 0;
}
.radio-inputs .radio input:checked + .name::after {
right: -10px;
border-bottom-left-radius: 300px;
box-shadow: -3px 3px 0px 3px #FFFFFF;
}
.radio-inputs .radio input:checked + .name::before {
left: -10px;
border-bottom-right-radius: 300px;
box-shadow: 3px 3px 0px 3px #FFFFFF;
}
]]></b:skin>
</head>
<body>
<!-- Navigation Menu -->
<div class='radio-inputs'>
<label class='radio'>
<input checked='' name='radio' type='radio'/>
<span class='name'>Home</span>
</label>
<label class='radio'>
<input name='radio' type='radio'/>
<span class='name'>HTML</span>
</label>
<label class='radio'>
<input name='radio' type='radio'/>
<span class='name'>CSS</span>
</label>
<label class='radio'>
<input name='radio' type='radio'/>
<span class='name'>JS</span>
</label>
<label class='radio'>
<input name='radio' type='radio'/>
<span class='name'>PHP</span>
</label>
<label class='radio'>
<input name='radio' type='radio'/>
<span class='name'>Name</span>
</label>
<label class='radio'>
<input name='radio' type='radio'/>
<span class='name'>Menu</span>
</label>
</div>
<!-- Main Section -->
<b:section class='main' id='main' showaddelement='yes'/>
</body>
</html>
สามารถใส่ script ก่อนปิด </body> หรือ หาแท็ก <head>
use & instead & always
The template must contain at least one b:section tag.
10. Blogger template code (with SEO)
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns='http://www.w3.org/1999/xhtml'
xmlns:b='http://www.google.com/2005/gml/b'
xmlns:data='http://www.google.com/2005/gml/data'
xmlns:expr='http://www.google.com/2005/gml/expr'>
<head>
<meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible'/>
<!-- VIEWPORT -->
<b:if cond='data:blog.isMobile'>
<meta name='viewport' content='width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0'/>
<b:else/>
<meta name='viewport' content='width=1100'/>
</b:if>
<!-- Blogger HEAD -->
<b:include data='blog' name='all-head-content'/>
<!-- TITLE -->
<title><data:blog.pageTitle/></title>
<!-- ==========================
SEO META TAGS
========================== -->
<!-- Meta Description -->
<meta name="description" expr:content="data:blog.metaDescription"/>
<!-- Keywords -->
<meta name="keywords" content="blogger, seo, website, travel, tutorial"/>
<meta name="author" content="Your Name"/>
<!-- Open Graph (Facebook / LINE) -->
<meta property="og:title" expr:content="data:blog.pageTitle"/>
<meta property="og:description" expr:content="data:blog.metaDescription"/>
<meta property="og:type" content="website"/>
<meta property="og:url" expr:content="data:blog.url"/>
<meta property="og:image" expr:content="data:blog.postImageUrl"/>
<!-- Twitter Card -->
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:title" expr:content="data:blog.pageTitle"/>
<meta name="twitter:description" expr:content="data:blog.metaDescription"/>
<meta name="twitter:image" expr:content="data:blog.postImageUrl"/>
<!-- Canonical -->
<link rel="canonical" expr:href="data:blog.url"/>
<!-- Robots -->
<meta name="robots" content="index, follow"/>
<meta name="googlebot" content="index, follow"/>
<!-- Schema.org -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebSite",
"url": "<data:blog.homepageUrl/>",
"name": "<data:blog.title/>",
"alternateName": "<data:blog.title/>"
}
</script>
<!-- Favicon -->
<link rel="icon" type="image/png" href="YOUR-FAVICON-URL.png"/>
<!-- ==========================
CSS ZONE
========================== -->
<b:skin>
<![CDATA[
/* ----- Your CSS Here ----- */
body { font-family: sans-serif; }
]]>
</b:skin>
</head>
<body>
<!-- MAIN CONTENT SECTION -->
<b:section class='main' id='main' showaddelement='yes'/>
<!-- CREDITS -->
<center><a href="//siammakemoney.com/">siammakemoney.com/</a></center>
</body>
</html>