Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let getIndex = function ()
  2. {
  3.     let index = readFile(__dirname + "/template/index.html"); // Get index template
  4.     let img = substituerEtiquette(index, "{{img}}", getImage());
  5.     let articles = "";
  6.  
  7.     let randomTitles = getRandomPageTitles(20);
  8.     randomTitles.forEach( function (x) {
  9.         let titleTemplate = "<li><a href=\"{{url}}\">{{title}}</a></li>";
  10.         randomTitles[randomTitles.indexOf(x)] = titleTemplate.replace("{{title}}", x).replace("{{url}}", "article/" + x);
  11.     });
  12.  
  13.     randomTitles.forEach(element => {
  14.         articles += element + "\n";
  15.     });
  16.  
  17.     return substituerEtiquette(img, "{{{articles-recents}}}", articles);
  18. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement