Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

291
Views
¿Qué hace la materia en la materia gris en el nodo js?
import fs from 'fs'; import path from 'path'; import matter from 'gray-matter'; const postsDirectory = path.join(process.cwd(), 'posts'); // ... ... ... // export function getPostData(id) { const fullPath = path.join(postsDirectory, `${id}.md`); const fileContents = fs.readFileSync(fullPath, 'utf8'); // Use gray-matter to parse the post metadata section const matterResult = matter(fileContents); // Combine the data with the id return { id, ...matterResult.data, }; }

¿Qué hace la materia en la materia gris en el nodo js?

Estoy probando el enrutamiento dinámico en Next.js, explique el uso de la función matter().

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede leer la documentación del paquete.

Verá un ejemplo escuchado allí:

Convierte una cadena con materia frontal, como esta:

 --- title: Hello slug: home --- <h1>Hello world!</h1>

En un objeto como este:

 { content: '<h1>Hello world!</h1>', data: { title: 'Hello', slug: 'home' } }

ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!