Skip to content

Remove custom tracking of other blogs #1545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/_index.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
+++
title = "Rust Blog"
index_title = "The Rust Programming Language Blog"
link_text = "the main Rust blog"
description = "Empowering everyone to build reliable and efficient software."
index_html = """
This is the <b>main Rust blog</b>. \
<a href="https://www.rust-lang.org/governance/">Rust teams</a> \
use this blog to announce major developments in the world of Rust."""
maintained_by = "the Rust Teams"
see_also_html = """<a href="/inside-rust/index.html">the &quot;Inside Rust&quot; blog</a>"""
+++
2 changes: 1 addition & 1 deletion content/inside-rust/_index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
+++
title = "Inside Rust Blog"
index_title = 'The "Inside Rust" Blog'
link_text = 'the "Inside Rust" blog'
description = "Want to follow along with Rust development? Curious how you might get involved? Take a look!"
index_html = """
This is the <b>"Inside Rust"</b> blog. This blog is aimed at those who wish \
Expand All @@ -10,4 +9,5 @@ to follow along with Rust development. The various \
use this blog to post status updates, calls for help, and other \
similar announcements."""
maintained_by = "the Rust Teams"
see_also_html = """<a href="/index.html">the main Rust blog</a>"""
+++
13 changes: 4 additions & 9 deletions src/blogs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@ pub struct Manifest {
/// Raw html describing the blog to insert into the index page.
pub(crate) index_html: String,

/// What text to use when linking to this blog in the "see also"
/// section from other blogs.
pub(crate) link_text: String,
/// What to show in the "see also" section of this blog.
pub(crate) see_also_html: String,
}

#[derive(Serialize)]
pub struct Blog {
title: String,
index_title: String,
link_text: String,
see_also_html: String,
description: String,
maintained_by: String,
index_html: String,
Expand Down Expand Up @@ -93,7 +92,7 @@ impl Blog {
description: manifest.description,
maintained_by: manifest.maintained_by,
index_html: manifest.index_html,
link_text: manifest.link_text,
see_also_html: manifest.see_also_html,
path,
pages: posts,
})
Expand All @@ -103,10 +102,6 @@ impl Blog {
&self.title
}

pub(crate) fn link_text(&self) -> &str {
&self.link_text
}

pub(crate) fn index_title(&self) -> &str {
&self.index_title
}
Expand Down
13 changes: 0 additions & 13 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,9 @@ impl Generator {
}

fn render_index(&self, blog: &Blog) -> eyre::Result<PathBuf> {
let other_blogs: Vec<_> = self
.blogs
.iter()
.filter(|b| b.index_title() != blog.index_title())
.map(|other_blog| {
json!({
"link_text": other_blog.link_text(),
"url": other_blog.path().join("index.html"),
})
})
.collect();

let data = json!({
"title": blog.index_title(),
"section": blog,
"other_blogs": other_blogs,
});
let path = blog.path().join("index.html");
self.render_template(&path, "index.html", data)?;
Expand Down
4 changes: 1 addition & 3 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
<div class="mw8-l">
<p>
<b>See also:</b>
{%- for other in other_blogs %}
<a href="/{{other.url}}">{{ macros::escape_hbs(input=other.link_text) }}</a>
{%- endfor %}
{{ section.see_also_html }}
</p>
</div>
</div>
Expand Down
Loading