Skip to content

Commit 398a92e

Browse files
committed
add blog homepaget
1 parent bd7c50e commit 398a92e

File tree

9 files changed

+191
-226
lines changed

9 files changed

+191
-226
lines changed

pgml-dashboard/src/api/cms.rs

Lines changed: 172 additions & 144 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
pub struct Content {
2-
3-
}
1+
pub struct Content {}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pub struct TocLink {}
1+
pub struct TocLink {}

pgml-dashboard/src/components/navigation/navbar/marketing/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<% } %>
7474

7575
<%+ MarketingLink::new().link(StaticNavLink::new("Docs".to_string(), "/docs/".to_string())) %>
76-
<%+ MarketingLink::new().link(StaticNavLink::new("Blog".to_string(), "/blog/speeding-up-vector-recall-by-5x-with-hnsw".to_string())) %>
76+
<%+ MarketingLink::new().link(StaticNavLink::new("Blog".to_string(), "/blog/".to_string())) %>
7777

7878
<% if !standalone_dashboard { %>
7979
<div class="d-none d-xl-flex">

pgml-dashboard/src/components/navigation/navbar/web_app/template.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<div class="vr my-2 opacity-100 d-lg-block d-none" style="width: 2px"></div>
5757

5858
<li class="nav-item d-flex align-items-center">
59-
<a class="nav-link p-lg-0" href="/blog/speeding-up-vector-recall-by-5x-with-hnsw">Blog</a>
59+
<a class="nav-link p-lg-0" href="/blog/">Blog</a>
6060
</li>
6161

6262
<% if !account_management_nav.links.is_empty() { %>
@@ -84,7 +84,7 @@
8484
</li>
8585

8686
<li class="menu-item rounded-0 d-flex align-items-center">
87-
<a href="/blog/speeding-up-vector-recall-by-5x-with-hnsw">Blog</a>
87+
<a href="/blog/">Blog</a>
8888
</li>
8989

9090
<% if !standalone_dashboard { %>

pgml-dashboard/src/components/sections/footers/marketing_footer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl MarketingFooter {
2424
StaticNavLink::new("Documentation".into(), "/docs/".into()),
2525
StaticNavLink::new(
2626
"Blog".into(),
27-
"/blog/speeding-up-vector-recall-by-5x-with-hnsw".into(),
27+
"/blog/".into(),
2828
),
2929
],
3030
company: vec![StaticNavLink::new(

pgml-dashboard/src/templates/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use pgml_components::Component;
22
use std::collections::HashMap;
33

4-
pub use crate::components::{self, NavLink, StaticNav, StaticNavLink, cms::index_link::IndexLink};
4+
pub use crate::components::{self, cms::index_link::IndexLink, NavLink, StaticNav, StaticNavLink};
55

66
use sailfish::TemplateOnce;
77
use sqlx::postgres::types::PgMoney;

pgml-dashboard/src/utils/config.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{
2-
env::var,
32
borrow::Cow,
4-
path::{Path, PathBuf}
3+
env::var,
4+
path::{Path, PathBuf},
55
};
66

77
use lazy_static::lazy_static;
@@ -53,8 +53,16 @@ impl Config {
5353
let css_version = env_string_default("CSS_VERSION", "");
5454
let js_version = env_string_default("JS_VERSION", "1");
5555

56-
let css_extension = if dev_mode { "css".to_string() } else { format!("{css_version}.css") };
57-
let js_extension = if dev_mode { "js".to_string() } else { format!("{js_version}.js") };
56+
let css_extension = if dev_mode {
57+
"css".to_string()
58+
} else {
59+
format!("{css_version}.css")
60+
};
61+
let js_extension = if dev_mode {
62+
"js".to_string()
63+
} else {
64+
format!("{js_version}.js")
65+
};
5866

5967
Config {
6068
dev_mode,

pgml-dashboard/src/utils/markdown.rs

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ use tantivy::tokenizer::{LowerCaser, NgramTokenizer, TextAnalyzer};
2525
use tantivy::{Index, IndexReader, SnippetGenerator};
2626
use url::Url;
2727

28-
use crate::components::cms::index_link::IndexLink;
2928
use std::fmt;
3029

3130
pub struct MarkdownHeadings {
@@ -572,74 +571,6 @@ pub fn nest_relative_links(node: &mut markdown::mdast::Node, path: &PathBuf) {
572571
});
573572
}
574573

575-
pub fn get_sub_links(list: &markdown::mdast::List, path: &Path) -> Result<Vec<IndexLink>> {
576-
let mut links = Vec::new();
577-
for node in list.children.iter() {
578-
match node {
579-
markdown::mdast::Node::ListItem(list_item) => {
580-
for node in list_item.children.iter() {
581-
match node {
582-
markdown::mdast::Node::Paragraph(paragraph) => {
583-
for node in paragraph.children.iter() {
584-
match node {
585-
markdown::mdast::Node::Link(link) => {
586-
for node in link.children.iter() {
587-
match node {
588-
markdown::mdast::Node::Text(text) => {
589-
let mut url = Path::new(&link.url)
590-
.with_extension("")
591-
.to_string_lossy()
592-
.to_string();
593-
if url.ends_with("README") {
594-
url = url.replace("README", "");
595-
}
596-
let url = path
597-
.join(url)
598-
.into_os_string()
599-
.into_string()
600-
.unwrap();
601-
let parent = IndexLink::new(text.value.as_str())
602-
.href(&url);
603-
links.push(parent);
604-
}
605-
_ => error!("unhandled link child: {:?}", node),
606-
}
607-
}
608-
}
609-
_ => error!("unhandled paragraph child: {:?}", node),
610-
}
611-
}
612-
}
613-
markdown::mdast::Node::List(list) => {
614-
let mut link = links.pop().unwrap();
615-
link.children = get_sub_links(list, path).unwrap();
616-
links.push(link);
617-
}
618-
_ => error!("unhandled list_item child: {:?}", node),
619-
}
620-
}
621-
}
622-
_ => error!("unhandled list child: {:?}", node),
623-
}
624-
}
625-
Ok(links)
626-
}
627-
628-
pub fn parse_summary_into_nav_links(
629-
root: &markdown::mdast::Node,
630-
path: &Path,
631-
) -> Result<Vec<IndexLink>> {
632-
for node in root.children().unwrap().iter() {
633-
match node {
634-
markdown::mdast::Node::List(list) => {
635-
return get_sub_links(list, path);
636-
}
637-
_ => { /* irrelevant */ }
638-
}
639-
}
640-
return Ok(vec![]);
641-
}
642-
643574
/// Get the title of the article.
644575
///
645576
/// # Arguments

0 commit comments

Comments
 (0)