create_post<-function(title, author="Andrea Gómez Vargas", categories=NULL, base_path="posts", description="Agrega aquí una breve descripción del contenido."){# Crear el nombre del slug basado en el títuloslug<-tolower(gsub(" ", "-", title))# Crear la ruta completa para la carpetafolder_path<-file.path(base_path, slug)# Crear la carpeta si no existeif(!dir.exists(folder_path)){dir.create(folder_path, recursive =TRUE)}# Generar la fecha actualdate<-Sys.Date()# Crear el contenido del YAMLyaml_content<-paste0("---\n","title: \"", title, "\"\n","author: \"", author, "\"\n","date: ", date, "\n","slug: ", slug, "\n","description: \"", description, "\"\n","categories: [", paste(categories, collapse =", "), "]\n","type: post\n","---\n\n","# ", title, "\n\n","Escribe aquí el contenido de tu publicación.\n")# Crear el archivo .qmdqmd_path<-file.path(folder_path, "index.qmd")writeLines(yaml_content, qmd_path)message("¡Post creado exitosamente en: ", folder_path, "!")}