Skip to content

Commit

Permalink
clean[api]!: remove SiteMapDate -> use frontmatter.
Browse files Browse the repository at this point in the history
Remove sitemap date data from the LinkMeta struct
since front_matter is not attached to it.
  • Loading branch information
teesloane committed Jan 15, 2022
1 parent c28e5ec commit 19daed0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
9 changes: 3 additions & 6 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
errors::{FirnError, FirnErrorType},
org,
org::OrgMetadata,
templates::{self, links::SitemapDate},
templates::{self},
templates::{
data,
links::{LinkData, LinkMeta},
Expand Down Expand Up @@ -300,7 +300,7 @@ impl<'a> Config<'a> {
let mut out: Vec<LinkData> = Vec::new();
for (_k, v) in &self.global_sitemap {
match &v.entity {
org::OrgMetadataType::Sitemap(fm) => {
org::OrgMetadataType::Sitemap(_fm) => {
let sitemap_item_url = format!(
"{}/{}",
self.user_config.site.url,
Expand All @@ -309,10 +309,7 @@ impl<'a> Config<'a> {
let x = LinkData::new(
sitemap_item_url,
v.originating_file.clone(),
LinkMeta::Sitemap(SitemapDate {
date_created: fm.date_created_ts,
date_updated: fm.date_updated_ts,
}),
LinkMeta::Sitemap,
Some(v.front_matter.clone())
);
out.push(x);
Expand Down
8 changes: 1 addition & 7 deletions src/templates/links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,12 @@ pub fn link_transformer(base_url: String, org_link_path: String) -> String {

// -- Link data for Tera to loop over --------------------------------------------

#[derive(Debug, PartialEq, Serialize)]
pub struct SitemapDate {
pub date_created: Option<i64>,
pub date_updated: Option<i64>,
}

#[derive(Debug, PartialEq, Serialize)]
pub enum LinkMeta {
Backlink,
RelatedFile,
Tag { count: usize },
Sitemap(SitemapDate),
Sitemap,
}

#[derive(Debug, PartialEq, Serialize)]
Expand Down

0 comments on commit 19daed0

Please sign in to comment.