write title inside the title tag

This commit is contained in:
Ashik K 2023-04-08 10:42:33 +02:00
parent f84152af82
commit 35978aa910
2 changed files with 7 additions and 1 deletions

View File

@ -51,6 +51,9 @@ int main()
std::ofstream post_file;
post_file.open(filename);
post_file << "<html>";
post_file<<"<title>";
post_file << post["title"].GetString();
post_file <<"</title>";
post_file << post["html"].GetString();
post_file <<"</html>";
post_file.close();

View File

@ -47,11 +47,14 @@ int main()
std::string postid = post["id"].GetString();
std::cout<< postid <<": "<<post["title"].GetString() <<std::endl;
char filename[64];
snprintf(filename, sizeof filename, "content/%s.html", postid.c_str());
snprintf(filename, sizeof filename, "content/post-%s.html", postid.c_str());
std::ofstream post_file;
post_file.open(filename);
post_file << "<html>";
post_file << post["html"].GetString();
post_file <<"<title>";
post_file << post["title"].GetString();
post_file <<"</title>";
post_file <<"</html>";
post_file.close();
}