diff --git a/README.md b/README.md index 4feedb3..838764b 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,23 @@ cp ./layouts/shortcodes/embed-pdf.html /path/to/your/hugo/website/layouts/shortc ```
-3. Copy the pdf.js library files from `./static/js/pdf-js` to `./static/js` in your Hugo website directory. +3. Copy the file `./layouts/partials/embed-pdf-dependencies.html` to `./layouts/partials` in your Hugo website directory. +
+ +```shell +cp ./layouts/partials/embed-pdf-dependencies.html /path/to/your/hugo/website/layouts/partials +``` +
+ +4. Add the `embed-pdf-dependencies.html` partial to your theme. + +You'll want to add the following line to a layout in your `partials` directory responsible for generating the `` section of your blog. This will include the JavaScript dependencies and CSS styles for the `hugo-embed-pdf` shortcode exactly once on pages that use it. + +``` +{{ partial "embed-pdf-dependencies.html" . }} +``` + +5. Copy the pdf.js library files from `./static/js/pdf-js` to `./static/js` in your Hugo website directory.
**Note:** If you do not have a `./static/js` directory you can create it. diff --git a/layouts/partials/embed-pdf-dependencies.html b/layouts/partials/embed-pdf-dependencies.html new file mode 100644 index 0000000..4cbf151 --- /dev/null +++ b/layouts/partials/embed-pdf-dependencies.html @@ -0,0 +1,51 @@ + {{ if .HasShortcode "embed-pdf" }} + + + + {{ end }} diff --git a/layouts/shortcodes/embed-pdf.html b/layouts/shortcodes/embed-pdf.html index e96dab9..966b8bf 100644 --- a/layouts/shortcodes/embed-pdf.html +++ b/layouts/shortcodes/embed-pdf.html @@ -1,202 +1,166 @@ - - - - -
- - -     - Page: / -
-
-
-
+
+
+
- + +
+ +
+ +     + + / + + [pdf]
+ +