Skip to content

Commit 84c961a

Browse files
committed
allow blogs to customize their link text
1 parent cef696d commit 84c961a

File tree

5 files changed

+5
-2
lines changed

5 files changed

+5
-2
lines changed

posts/blog.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
title: Rust Blog
22
index-title: The Rust Programming Language Blog
3+
link-text: the main Rust blog
34
description: Empowering everyone to build reliable and efficient software.
45
index-html: This is the <b>main Rust blog</b>. We use this blog to
56
announce big developments in the world of Rust.

posts/inside-rust/blog.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
title: Inside Rust Blog
22
index-title: The "Inside Rust" Blog
3+
link-text: the "Inside Rust" blog
34
description: Want to follow along with Rust development? Curious how you might get involved? Take a look!
45
index-html: This is the <b>"Inside Rust"</b> blog. This blog is aimed at those who wish
56
to follow along with Rust development. The various

src/blogs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub(crate) struct Manifest {
1515
pub(crate) maintained_by: String,
1616
pub(crate) index_html: String,
1717
pub(crate) requires_team: bool,
18+
pub(crate) link_text: String,
1819
}
1920

2021
#[derive(Serialize)]

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl Generator {
133133
fn render_index(&self, blog: &Blog) -> Result<(), Box<dyn Error>> {
134134
let other_blogs: Vec<_> = self.blogs.iter().filter(|b| b.index_title() != blog.index_title())
135135
.map(|other_blog| json!({
136-
"name": other_blog.title(),
136+
"link_text": other_blog.link_text(),
137137
"url": PathBuf::from("/").join(other_blog.prefix()).join("index.html"),
138138
}))
139139
.collect();

templates/index.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<p>
1111
<b>See also:</b>
1212
{{#each other_blogs}}
13-
<a href="{{url}}">the {{name}}</a>
13+
<a href="{{url}}">{{link_text}}</a>
1414
{{/each}}
1515
</p>
1616
</div>

0 commit comments

Comments
 (0)