Skip to content

Commit 40c79d8

Browse files
authored
Merge pull request #16 from 42devops/perf/inline-svg-icons
perf: replace webfont icon requests with zero-latency inline SVGs
2 parents 691eebb + 054c264 commit 40c79d8

4 files changed

Lines changed: 31 additions & 30 deletions

File tree

_layouts/default.html

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
<meta name="description" content="Engineering thoughts on DevOps, Kubernetes, Infrastructure, and Algorithms." />
99
<meta name="author" content="42DevOps" />
1010

11-
<!-- Google Fonts & Material Symbols -->
11+
<!-- Google Fonts -->
1212
<link rel="preconnect" href="https://fonts.googleapis.com">
1313
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
1414
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Noto+Serif+SC:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Shantell+Sans:ital,wght@0,400;0,500;0,600;1,400&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,500;0,8..60,600;1,8..60,400&display=swap" rel="stylesheet">
15-
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
1615

1716
<!-- Stylesheets (with cache-busting timestamp) -->
1817
<link rel="stylesheet" href="/css/syntax.css?v={{ site.time | date: '%s' }}" type="text/css" />
@@ -63,7 +62,7 @@
6362
</ul>
6463

6564
<button class="theme-toggle-btn" id="theme-toggle" aria-label="Toggle Theme">
66-
<span class="material-symbols-outlined" id="theme-icon" style="font-size: 1.1rem;">dark_mode</span>
65+
<span id="theme-icon-container" style="display: inline-flex; align-items: center;"></span>
6766
<span id="theme-label" style="font-size: 0.8rem; font-weight: 600;">Dark</span>
6867
</button>
6968
</nav>
@@ -78,7 +77,10 @@
7877
&copy; {{ "now" | date: "%Y" }} <strong>42DevOps</strong>. Powered by <a href="https://jekyllrb.com" target="_blank" rel="noopener">Jekyll</a> &amp; GitHub Pages.
7978
</div>
8079
<div class="footer-links">
81-
<a href="/atom.xml">RSS Feed</a>
80+
<a href="/atom.xml" style="display: inline-flex; align-items: center; gap: 0.3rem;">
81+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 11a9 9 0 0 1 9 9"/><path d="M4 4a16 16 0 0 1 16 16"/><circle cx="5" cy="19" r="1"/></svg>
82+
<span>RSS Feed</span>
83+
</a>
8284
<a href="https://42devops.com">42devops.com</a>
8385
</div>
8486
</footer>
@@ -89,15 +91,18 @@
8991
document.addEventListener('DOMContentLoaded', function() {
9092
// Theme Switcher Logic
9193
const toggleBtn = document.getElementById('theme-toggle');
92-
const themeIcon = document.getElementById('theme-icon');
94+
const themeIconContainer = document.getElementById('theme-icon-container');
9395
const themeLabel = document.getElementById('theme-label');
9496

97+
const sunSVG = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/></svg>`;
98+
const moonSVG = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/></svg>`;
99+
95100
function updateThemeUI(theme) {
96101
if (theme === 'dark') {
97-
themeIcon.textContent = 'light_mode';
102+
if (themeIconContainer) themeIconContainer.innerHTML = sunSVG;
98103
themeLabel.textContent = 'Light';
99104
} else {
100-
themeIcon.textContent = 'dark_mode';
105+
if (themeIconContainer) themeIconContainer.innerHTML = moonSVG;
101106
themeLabel.textContent = 'Dark';
102107
}
103108
}

_layouts/post.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<header class="post-header">
77
<div style="margin-bottom: 1rem;">
88
<a href="/" style="text-decoration: none; color: var(--text-muted); font-size: 0.875rem; font-weight: 500; display: inline-flex; align-items: center; gap: 0.35rem;">
9-
<span class="material-symbols-outlined" style="font-size: 1rem;">arrow_back</span> Back to articles
9+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m12 19-7-7 7-7"/><path d="M19 12H5"/></svg> Back to articles
1010
</a>
1111
</div>
1212

@@ -15,13 +15,13 @@ <h1 class="post-title">{{ page.title }}</h1>
1515
<div class="post-meta-bar">
1616
{% if page.date %}
1717
<time datetime="{{ page.date | date_to_xmlschema }}" style="font-family: var(--font-mono); font-weight: 500; display: inline-flex; align-items: center; gap: 0.25rem;">
18-
<span class="material-symbols-outlined" style="font-size: 0.95rem; color: var(--text-light);">calendar_today</span> {{ page.date | date: "%b %d, %Y" }}
18+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="var(--text-light)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="4" rx="2" ry="2"/><line x1="16" x2="16" y1="2" y2="6"/><line x1="8" x2="8" y1="2" y2="6"/><line x1="3" x2="21" y1="10" y2="10"/></svg> {{ page.date | date: "%b %d, %Y" }}
1919
</time>
2020
{% endif %}
2121

2222
{% if page.categories %}
2323
<div style="display: flex; gap: 0.4rem; align-items: center;">
24-
<span class="material-symbols-outlined" style="font-size: 0.95rem; color: var(--text-light);">sell</span>
24+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="var(--text-light)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2H2v10l9.29 9.29c.94.94 2.48.94 3.42 0l6.58-6.58c.94-.94.94-2.48 0-3.42L12 2Z"/><path d="M7 7h.01"/></svg>
2525
{% for category in page.categories %}
2626
<span class="tag-badge">{{ category }}</span>
2727
{% endfor %}
@@ -30,7 +30,7 @@ <h1 class="post-title">{{ page.title }}</h1>
3030

3131
<!-- Reading time estimate -->
3232
<span style="font-family: var(--font-mono); font-size: 0.825rem; color: var(--text-light); display: inline-flex; align-items: center; gap: 0.25rem;">
33-
<span class="material-symbols-outlined" style="font-size: 0.95rem; color: var(--text-light);">schedule</span>
33+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="var(--text-light)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
3434
{% assign words = content | number_of_words %}
3535
{% if words < 360 %}
3636
1 min read

css/screen.css

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -76,23 +76,10 @@ html {
7676
-moz-osx-font-smoothing: grayscale;
7777
}
7878

79-
/* Google Material Symbols Font Styling */
80-
.material-symbols-outlined {
81-
font-family: 'Material Symbols Outlined';
82-
font-weight: normal;
83-
font-style: normal;
84-
font-size: 1.25rem;
85-
line-height: 1;
86-
letter-spacing: normal;
87-
text-transform: none;
88-
display: inline-block;
89-
white-space: nowrap;
90-
word-wrap: normal;
91-
direction: ltr;
92-
-webkit-font-smoothing: antialiased;
93-
-moz-osx-font-smoothing: grayscale;
94-
text-rendering: optimizeLegibility;
95-
font-feature-settings: 'liga';
79+
/* Inline SVG Icon Helper */
80+
svg {
81+
vertical-align: middle;
82+
flex-shrink: 0;
9683
}
9784

9885
body {

index.html

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@
1010
<span class="ann ann-e ann-purple ann-no-mark" data-note="Keep Walking" style="--ann-font-size: 1.25rem; --ann-font-weight: 600; --ann-target-gap: 8px;">
1111
<span class="ann ann-w ann-green ann-no-mark" data-note="Mostly Harmless" style="--ann-font-size: 1.25rem; --ann-font-weight: 600; --ann-target-gap: 8px;">
1212
<span style="display: inline-flex; align-items: center; justify-content: center; user-select: none;">
13-
<span class="material-symbols-outlined" style="font-size: 3.5rem; color: var(--brand-primary); line-height: 1;">directions_walk</span>
13+
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="var(--brand-primary)" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
14+
<path d="m19 19-3-3v-3l2-1" />
15+
<path d="M13 18l-2-3-2 2-3 3" />
16+
<path d="M10 12l2-3 2 1 2 4" />
17+
<path d="M8 21l3-5" />
18+
<circle cx="13" cy="4" r="2" />
19+
</svg>
1420
</span>
1521
</span>
1622
</span>
@@ -67,7 +73,10 @@ <h2 class="section-title">Featured Projects</h2>
6773
<a href="https://github.com/42devops/salt-kube-lite" target="_blank" rel="noopener" class="project-card">
6874
<div>
6975
<div class="project-name">
70-
<span style="display: flex; align-items: center; gap: 0.35rem;"><span class="material-symbols-outlined" style="font-size: 1.15rem; color: var(--brand-primary);">bolt</span> Salt-Kube Lite</span>
76+
<span style="display: flex; align-items: center; gap: 0.35rem;">
77+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="var(--brand-primary)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>
78+
Salt-Kube Lite
79+
</span>
7180
<span class="tag-badge">Kubernetes</span>
7281
</div>
7382
<p class="project-desc">

0 commit comments

Comments
 (0)