mirror of
https://gitlab.com/Anson-Projects/projects.git
synced 2025-09-19 12:02:38 +00:00
Compare commits
8 Commits
ghost-cont
...
master
Author | SHA1 | Date | |
---|---|---|---|
bbeb71b1b5 | |||
fb197830aa | |||
1a7ecc1acd | |||
f81c2a6e21 | |||
cf5021e682 | |||
54f2a1bc53 | |||
a6dd33ce5f | |||
556c56fee4 |
@@ -16,6 +16,8 @@ staging:
|
|||||||
script:
|
script:
|
||||||
- echo "Building the main website with Quarto..."
|
- echo "Building the main website with Quarto..."
|
||||||
- quarto render --to html --output-dir public
|
- quarto render --to html --output-dir public
|
||||||
|
- echo "Checking for RSS feed after render..."
|
||||||
|
- ls -la public/ | grep -E "\.xml|index\.xml" || echo "No XML files found in public directory"
|
||||||
- echo "Building Ghost-optimized version..."
|
- echo "Building Ghost-optimized version..."
|
||||||
- quarto render --profile ghost --to html --output-dir public/ghost-content
|
- quarto render --profile ghost --to html --output-dir public/ghost-content
|
||||||
artifacts:
|
artifacts:
|
||||||
|
11
_quarto.yml
11
_quarto.yml
@@ -1,12 +1,18 @@
|
|||||||
project:
|
project:
|
||||||
type: website
|
type: website
|
||||||
|
|
||||||
|
website:
|
||||||
|
title: "Anson's Projects"
|
||||||
|
site-url: https://projects.ansonbiggs.com
|
||||||
|
description: A Blog for Technical Topics
|
||||||
|
|
||||||
profiles:
|
profiles:
|
||||||
default:
|
default:
|
||||||
website:
|
website:
|
||||||
title: "Anson's Projects"
|
title: "Anson's Projects"
|
||||||
site-url: https://projects.ansonbiggs.com
|
site-url: https://projects.ansonbiggs.com
|
||||||
description: A Blog for Technical Topics
|
description: A Blog for Technical Topics
|
||||||
|
author: "Anson Biggs"
|
||||||
navbar:
|
navbar:
|
||||||
left:
|
left:
|
||||||
- text: "About"
|
- text: "About"
|
||||||
@@ -17,6 +23,11 @@ profiles:
|
|||||||
# - icon: gitlab
|
# - icon: gitlab
|
||||||
# href: https://gitlab.com/MisterBiggs
|
# href: https://gitlab.com/MisterBiggs
|
||||||
open-graph: true
|
open-graph: true
|
||||||
|
feed:
|
||||||
|
title: "Anson's Projects"
|
||||||
|
description: "A Blog for Technical Topics"
|
||||||
|
author: "Anson Biggs"
|
||||||
|
items: 10
|
||||||
format:
|
format:
|
||||||
html:
|
html:
|
||||||
theme: zephyr
|
theme: zephyr
|
||||||
|
@@ -5,8 +5,6 @@ publish:
|
|||||||
- cd ./ghost-upload
|
- cd ./ghost-upload
|
||||||
- cargo run
|
- cargo run
|
||||||
needs:
|
needs:
|
||||||
- job: pages
|
- pages
|
||||||
optional: true
|
|
||||||
rules:
|
rules:
|
||||||
- if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
|
- if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
|
||||||
- if: "$CI_COMMIT_BRANCH == 'ghost-content-extraction'" # Allow testing on this branch
|
|
||||||
|
@@ -227,48 +227,12 @@ async fn get_existing_post_id(slug: &str, token: &str) -> Option<String> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn fetch_feed(url: &str) -> Vec<Entry> {
|
async fn fetch_feed(path: &str) -> Vec<Entry> {
|
||||||
println!("Fetching RSS feed from: {}", url);
|
// Read from local file instead of HTTP request
|
||||||
|
let content = std::fs::read_to_string(path).expect("Failed to read RSS feed file");
|
||||||
let response = reqwest::get(url).await;
|
|
||||||
let response = match response {
|
let feed = parser::parse(content.as_bytes()).expect("Failed to parse RSS feed");
|
||||||
Ok(resp) => resp,
|
|
||||||
Err(e) => {
|
|
||||||
println!("Failed to fetch RSS feed: {}", e);
|
|
||||||
return vec![];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if !response.status().is_success() {
|
|
||||||
println!("RSS feed request failed with status: {}", response.status());
|
|
||||||
return vec![];
|
|
||||||
}
|
|
||||||
|
|
||||||
let content = match response.text().await {
|
|
||||||
Ok(text) => text,
|
|
||||||
Err(e) => {
|
|
||||||
println!("Failed to read RSS feed content: {}", e);
|
|
||||||
return vec![];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if content.trim().is_empty() {
|
|
||||||
println!("RSS feed content is empty");
|
|
||||||
return vec![];
|
|
||||||
}
|
|
||||||
|
|
||||||
println!("RSS feed content preview: {}", &content[..content.len().min(200)]);
|
|
||||||
|
|
||||||
let feed = match parser::parse(content.as_bytes()) {
|
|
||||||
Ok(f) => f,
|
|
||||||
Err(e) => {
|
|
||||||
println!("Failed to parse RSS feed: {:?}", e);
|
|
||||||
println!("Feed content starts with: {}", &content[..content.len().min(500)]);
|
|
||||||
return vec![];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
println!("Successfully parsed RSS feed with {} entries", feed.entries.len());
|
|
||||||
feed.entries
|
feed.entries
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,7 +297,7 @@ async fn main() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
let feed = "https://projects.ansonbiggs.com/index.xml";
|
let feed = "../public/index.xml";
|
||||||
|
|
||||||
// Split the key into ID and SECRET
|
// Split the key into ID and SECRET
|
||||||
let (id, secret) = ghost_admin_api_key
|
let (id, secret) = ghost_admin_api_key
|
||||||
@@ -365,13 +329,6 @@ async fn main() {
|
|||||||
|
|
||||||
// Prepare the post data
|
// Prepare the post data
|
||||||
let entries = fetch_feed(feed).await;
|
let entries = fetch_feed(feed).await;
|
||||||
|
|
||||||
if entries.is_empty() {
|
|
||||||
println!("No entries found in RSS feed or feed parsing failed. Exiting.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
println!("Processing {} entries from RSS feed", entries.len());
|
|
||||||
|
|
||||||
let post_exists_futures = entries.into_iter().map(|entry| {
|
let post_exists_futures = entries.into_iter().map(|entry| {
|
||||||
let entry_clone = entry.clone();
|
let entry_clone = entry.clone();
|
||||||
|
Reference in New Issue
Block a user