Skip to content

pgabriel02/resource-importer

Repository files navigation

Astro Resource Manager for Resurse.dev

Features

  • Takes the meta from the link parameter and automatically generates an .md content file in the appropriate format for Resurse.dev.

Installation

npm i https://github.com/pgabriel02/resource-importer

Then import the helper function in your project:

import generateResourceFileWithMetadata from 'resource-importer'

Then use it when appropriate:

use await generateResourceFileWithMetadata(url);

Example

Example function

import { getCollection } from 'astro:content'
import { generateResourceFileWithMetadata } from 'resource-importer'

async function test() {
	const config = await getCollection('resources')
	await generateResourceFileWithMetadata({
		url: 'https://www.youtube.com/watch?v=nm2wIUr5KNk',
		contentKey: 'resources',
		configData: config,
		elementsToBeEdited: {
			title: 'title',
			url: 'url',
			imageUrl: 'banner',
			imageAlt: 'title'
		}
	})
}
test()
import generateResourceFileWithMetadata from 'resource-importer'

await generateResourceFileWithMetadata('https://www.youtube.com/watch?v=nzSsv9c_ynQ&t=7503s&ab_channel=ViorelMocanu')

Will output these files:

🌟 title.md

title.md

🌟 image file

image file

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published