Skip to content

Commit

Permalink
Update 1.11.0 (#29)
Browse files Browse the repository at this point in the history
### Features

- Add new options to rss configuration
- Add redirect urls

### Changes

- Update dependencies

### Fixes

- Fix wrong lucasjosino.com project image

### Issues

- Closes #28 

*Bump version to 1.11.0*
  • Loading branch information
LucJosin committed Jun 11, 2024
1 parent a0b8170 commit ca91b0a
Show file tree
Hide file tree
Showing 6 changed files with 470 additions and 412 deletions.
3 changes: 3 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import numberedFootnoteLabels from 'remark-numbered-footnote-labels';
import remarkToc from 'remark-toc';

import HashRenamer from './src/lib/hash-renamer';
import getRedirects from './src/lib/redirects';

const cssPrefix = 'astro-';
const renamer = new HashRenamer(cssPrefix);
Expand Down Expand Up @@ -55,6 +56,8 @@ export default defineConfig({
//
// ‘static’ - Building a static site to be deploy to any static host.
output: 'static',
// Specify a mapping of redirects where the key is the route to match and the value is the path to redirect to.
redirects: getRedirects(),
// Astro integrations.
//
// Ref: https://docs.astro.build/en/guides/integrations-guide/
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@lucjosin/lucasjosino.com",
"packageManager": "yarn@3.6.4",
"version": "1.10.0",
"version": "1.11.0",
"private": true,
"scripts": {
"dev": "astro dev",
Expand All @@ -21,8 +21,8 @@
"@lucjosin/remark-readme-stats": "./plugins/remark-readme-stats",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"astro": "^4.8.6",
"astro-compress": "^2.2.23",
"astro": "^4.10.1",
"astro-compress": "^2.2.27",
"astro-expressive-code": "^0.35.3",
"astro-icon": "^1.1.0",
"astro-rename": "^1.1.2",
Expand All @@ -31,8 +31,8 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-astro": "^0.31.4",
"javascript-time-ago": "^2.5.10",
"prettier": "^3.2.5",
"prettier-plugin-astro": "^0.13.0",
"prettier": "^3.3.1",
"prettier-plugin-astro": "^0.14.0",
"rehype-autolink-headings": "^7.1.0",
"rehype-external-links": "^3.0.0",
"rehype-slug": "^6.0.0",
Expand Down
3 changes: 1 addition & 2 deletions src/constants/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ export const projects: ProjectModel[] = [
category: 'Collection',
},
{
image:
'https://repository-images.githubusercontent.com/527544916/e59a3b38-f658-4e42-b4a8-fe6d4a3b551c',
image: 'https://www.lucasjosino.com/static/default-og.png',
title: 'lucasjosino.com',
description:
'Minimalist portfolio website/blog built with Astro & Typescript.',
Expand Down
6 changes: 6 additions & 0 deletions src/lib/redirects.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default function getRedirects() {
return {
'/blog/go-tests-creating-a-session-mock-for-authentication-using-scs/':
'/blog/how-to-hash-class-names-in-astro-using-astro-rename-integration/',
};
}
45 changes: 36 additions & 9 deletions src/pages/rss.xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,44 @@ import { getAllPosts } from '@lib/blog';

export async function GET() {
const posts = await getAllPosts();

const domain = headConfig.canonical;
return rss({
title: 'Lucas Josino',
description:
'A minimalist developer blog with thoughts, ideas and other stuff',
site: headConfig.canonical,
items: posts.map(({ data: { publishedAt, title, description }, slug }) => ({
title,
description,
link: `${headConfig.canonical}/blog/${slug}`,
pubDate: new Date(publishedAt),
})),
'Explore my developer blog with thoughts, ideas and other stuff.',
site: domain,
xmlns: {
webfeeds: 'http://webfeeds.org/rss/1.0',
media: 'http://search.yahoo.com/mrss/',
},
items: posts.map((item) => {
const post = item.data;
return {
title: post.title,
description: post.description,
link: `${domain}/blog/${item.slug}`,
pubDate: new Date(post.publishedAt),
commentsUrl: `${domain}/blog/${item.slug}/#comments`,
author: `Lucas Josino (contact@lucasjosino.com)`,
categories: [post.category],
enclosure: {
url: `${post.image.src}`,
type: `image/${post.image.src.split('.').pop()}`,
length: 23600,
},
customData:
`<language>${post.language}</language>` +
`<media:content
url="${post.image.src}"
medium="image"
type="image/${post.image.src.split('.').pop()}"
width="1200"
height="630" />`,
};
}),
customData:
`<author><name>Lucas Josino</name><email>contact@lucasjosino.com</email></author>` +
`<copyright>${headConfig.copyright}</copyright>` +
`<lastBuildDate>${new Date().toUTCString()}</lastBuildDate>`,
});
}
Loading

0 comments on commit ca91b0a

Please sign in to comment.