diff --git a/lib/jekyll-pandoc-multiple-formats/pandoc_file.rb b/lib/jekyll-pandoc-multiple-formats/pandoc_file.rb
index 7afa130a5058fc81a84d62698d51a91c1ef62d8d..ef02ac7d166765500a49062dbfed4f334ae092af 100644
--- a/lib/jekyll-pandoc-multiple-formats/pandoc_file.rb
+++ b/lib/jekyll-pandoc-multiple-formats/pandoc_file.rb
@@ -67,6 +67,14 @@ module Jekyll
         path << @format
       end
 
+      # if permalink ends with trailing .html or trailing slash, path now ends with proper suffix
+      # for other cases (permalink with no trailing extension or slash), append format
+      # (ie /year/month/slug permalink --> /year/month/slug.pdf)
+      if not path.end_with? ".#{@format}"
+        path << '.'
+        path << @format
+      end
+
       path
     end