Skip to content

Commit e76c494

Browse files
committed
feat(themes): add typewriter theme
1 parent c2b4653 commit e76c494

File tree

12 files changed

+953
-0
lines changed

12 files changed

+953
-0
lines changed

blogr-cli/src/generator/site.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,20 @@ Thank you!`);
380380
if let Ok(frontmatter_data) =
381381
serde_yaml::from_str::<serde_yaml::Value>(&frontmatter)
382382
{
383+
// Override description with content.md description if it exists
384+
if let Some(description) = frontmatter_data.get("description") {
385+
if let Some(desc_str) = description.as_str() {
386+
context.insert("blog_description", desc_str);
387+
}
388+
}
389+
390+
// Override title with content.md title if it exists
391+
if let Some(title) = frontmatter_data.get("title") {
392+
if let Some(title_str) = title.as_str() {
393+
context.insert("blog_title", title_str);
394+
}
395+
}
396+
383397
// Extract sections if they exist
384398
if let Some(sections) = frontmatter_data.get("sections") {
385399
context.insert("sections", sections);

blogr-themes/src/dark_minimal/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ sections:
235235
github: "https://github.com/yourusername"
236236
twitter: "https://twitter.com/yourusername"
237237
linkedin: "https://linkedin.com/in/yourusername"
238+
blog: "https://yourblog.com"
238239
---
239240
"##,
240241
author,

blogr-themes/src/dark_minimal/templates/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ <h1 class="glitch-text" data-text="{{ blog_title }}">{{ blog_title }}</h1>
4545
</svg>
4646
</a>
4747
{% endif %}
48+
{% if sections.contact.social.blog %}
49+
<a href="{{ sections.contact.social.blog }}" class="social-link" aria-label="Blog" target="_blank" rel="noopener">
50+
<svg viewBox="0 0 24 24" fill="currentColor">
51+
<path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14 6 17h12l-3.86-5.14z"/>
52+
</svg>
53+
</a>
54+
{% endif %}
4855
</div>
4956
{% endif %}
5057
</section>

blogr-themes/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ pub mod musashi;
77
pub mod obsidian;
88
pub mod slate_portfolio;
99
pub mod terminal_candy;
10+
pub mod typewriter;
1011

1112
pub use dark_minimal::DarkMinimalTheme;
1213
pub use minimal_retro::MinimalRetroTheme;
1314
pub use musashi::MusashiTheme;
1415
pub use obsidian::ObsidianTheme;
1516
pub use slate_portfolio::SlatePortfolioTheme;
1617
pub use terminal_candy::TerminalCandyTheme;
18+
pub use typewriter::TypewriterTheme;
1719

1820
#[derive(Debug, Clone, Serialize, Deserialize)]
1921
pub struct ThemeInfo {
@@ -60,6 +62,9 @@ pub fn get_all_themes() -> HashMap<String, Box<dyn Theme>> {
6062
let slate_portfolio = SlatePortfolioTheme::new();
6163
themes.insert("slate-portfolio".to_string(), Box::new(slate_portfolio));
6264

65+
let typewriter = TypewriterTheme::new();
66+
themes.insert("typewriter".to_string(), Box::new(typewriter));
67+
6368
themes
6469
}
6570

@@ -72,6 +77,7 @@ pub fn get_theme(name: &str) -> Option<Box<dyn Theme>> {
7277
"dark-minimal" => Some(Box::new(DarkMinimalTheme::new()) as Box<dyn Theme>),
7378
"musashi" => Some(Box::new(MusashiTheme::new()) as Box<dyn Theme>),
7479
"slate-portfolio" => Some(Box::new(SlatePortfolioTheme::new()) as Box<dyn Theme>),
80+
"typewriter" => Some(Box::new(TypewriterTheme::new()) as Box<dyn Theme>),
7581
_ => None,
7682
}
7783
}

blogr-themes/src/musashi/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ sections:
233233
github: "https://github.com/yourusername"
234234
twitter: "https://twitter.com/yourusername"
235235
linkedin: "https://linkedin.com/in/yourusername"
236+
blog: "https://yourblog.com"
236237
---
237238
"##,
238239
author,

blogr-themes/src/musashi/templates/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,13 @@ <h2 class="section-title">{{ sections.contact.title | default(value="Contact") }
162162
</svg>
163163
</a>
164164
{% endif %}
165+
{% if sections.contact.social.blog %}
166+
<a href="{{ sections.contact.social.blog }}" class="social-link" aria-label="Blog" target="_blank" rel="noopener">
167+
<svg viewBox="0 0 24 24" fill="currentColor">
168+
<path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14 6 17h12l-3.86-5.14z"/>
169+
</svg>
170+
</a>
171+
{% endif %}
165172
</div>
166173
{% endif %}
167174
</div>

blogr-themes/src/slate_portfolio/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ sections:
192192
github: "https://github.com/yourusername"
193193
twitter: "https://twitter.com/yourusername"
194194
linkedin: "https://linkedin.com/in/yourusername"
195+
blog: "https://yourblog.com"
195196
---
196197
"##,
197198
author,

blogr-themes/src/slate_portfolio/templates/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ <h2 class="section-title">{{ sections.contact.title | default(value="Contact") }
117117
</svg>
118118
</a>
119119
{% endif %}
120+
{% if sections.contact.social.blog %}
121+
<a href="{{ sections.contact.social.blog }}" class="social-link" aria-label="Blog" target="_blank" rel="noopener">
122+
<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
123+
<path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14 6 17h12l-3.86-5.14z"/>
124+
</svg>
125+
</a>
126+
{% endif %}
120127
</div>
121128
{% endif %}
122129
</div>

0 commit comments

Comments
 (0)