feat: add multilingual theme introduction posts

- Added localized Retypeset theme introduction posts for multiple languages
- Included posts in English, Spanish, Russian, Japanese, Chinese (Simplified and Traditional)
- Standardized post structure with consistent metadata and content
- Updated content configuration to support multilingual post entries
This commit is contained in:
radishzzz 2025-01-26 08:16:48 +00:00
parent e43036ae3a
commit d72ec58837
24 changed files with 425 additions and 669 deletions

View file

@ -2,11 +2,16 @@
import PhotoSwipeLightbox from 'photoswipe/lightbox'
import 'photoswipe/style.css'
// Store lightbox instance for later use
let lightbox: PhotoSwipeLightbox | null = null
const pswp = import('photoswipe')
// Initialize PhotoSwipe lightbox with custom configuration
function cleanup() {
if (lightbox) {
lightbox.destroy()
lightbox = null
}
}
function createPhotoSwipe() {
// Clean up existing instance if any
cleanup()
@ -24,7 +29,7 @@
doubleTapAction: 'zoom',
})
// Add custom filter to handle image data and dimensions
// Automatically add image dimensions
lightbox.addFilter('domItemData', (itemData: any, element: Element) => {
if (element instanceof HTMLImageElement) {
itemData.src = element.src
@ -38,15 +43,6 @@
lightbox.init()
}
// Cleanup function to destroy lightbox instance
function cleanup() {
if (lightbox) {
lightbox.destroy()
lightbox = null
}
}
// Initialize PhotoSwipe when DOM is ready and after page transitions
document.addEventListener('astro:page-load', createPhotoSwipe)
document.addEventListener('astro:before-swap', cleanup)
</script>