routes.pm 932 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package Theme;
  2. use strict;
  3. use warnings;
  4. no warnings 'experimental';
  5. use feature qw{signatures};
  6. use lib 'lib';
  7. use Trog::Routes::HTML;
  8. our %routes = (
  9. '/links' => {
  10. method => 'GET',
  11. callback => \&links,
  12. },
  13. '/' => {
  14. method => "GET",
  15. data => { tag => ['news'] },
  16. callback => \&Trog::Routes::HTML::posts
  17. },
  18. );
  19. my $processor = Text::Xslate->new(
  20. path => 'www/themes/teodesian.net/templates',
  21. );
  22. my %paths = (
  23. '/news' => 'Headline Nudes',
  24. '/' => 'Headline Nudes',
  25. );
  26. sub path_to_tile ($path) {
  27. return $paths{$path} ? $paths{$path} : $path;
  28. }
  29. sub links ($query, $input, $render_cb) {
  30. my $content = $processor->render('links.tx', {
  31. title => "Approved Propaganda from the ministry of family values",
  32. theme_dir => 'themes/teodesian.net',
  33. });
  34. return Trog::Routes::HTML::index($query, $input, $render_cb, $content);
  35. }
  36. 1;