// created by Griffith for neocities.org // llumen.neocities.com/about.html // feel free to use and modify this for your own site // also, feel free to make a version in another language // if you do, please let me know so I can upload it here too #include #include #include #include void main() { // necessary metadata variables // change the values below to your site info // you can also prefil some of the links and scripts on lines 154-160 char title[512]; char description[2048]; char keywords[1024]; char author[] = "your name"; // these are just the url prefixes for the pages. // Each time the script will ask for the other part char image[1024] = "https://yoursite.com/"; char address[1024] = "https://yoursite.com/"; // print usage info printf("Website Metadata Generator\n"); printf("To use, enter the requested information.\n"); printf("Note: the output will be a file created in \n\ the directory you specify in the website address.\n\ It is best to have this in the root folder of your site,\n\ But otherwise can be used if you ensure the folder it is \n\ meant to write to exists.\n\n"); //get the required metadata printf("Enter the title: "); fgets(title, 512, stdin); // removes the trailing newline. // credit to a stack exchange post strtok(title, "\n"); printf("Enter the description: "); fgets(description, 2048, stdin); strtok(description, "\n"); printf("Enter keywords (separated by \",\"): "); fgets(keywords, 1024, stdin); strtok(keywords, "\n"); // uncomment if you want to change the author each time // printf("Enter the author: "); // fgets(author); printf("Enter the image link: %s", address); char imageEnd[512]; fgets(imageEnd, 512, stdin); strtok(imageEnd, "\n"); strcat(image, imageEnd); printf("Enter the website address: %s", address); char addressEnd[512]; fgets(addressEnd, 512, stdin); strtok(addressEnd, "\n"); //ensure the file will not overwrite an existing one while (access(addressEnd, F_OK) != -1) { printf("File %s already exists. Enter another name: ", addressEnd); fgets(addressEnd, 512, stdin); strtok(addressEnd, "\n"); } strcat(address, addressEnd); // put together the template // quite messy, but it works, and I am not familiar enough with c // at the moment to make it cleaner char* html = (char*)malloc(100000 * sizeof(char)); strcpy(html, " \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n \n \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ "); strcat(html, title); strcat(html, "\n\ \n\ \n\ \n\ \n\ \n\ -->\n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\n\ "); //uncomment if you want the output shown in console //printf(html); // output and clean up FILE* htmlOut = fopen(addressEnd, "w"); fputs(html, htmlOut); fclose(htmlOut); free(html); printf("Done\n\n"); }