Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the steps to install the shortcode as a theme component using Git submodules #39

Merged
merged 3 commits into from
Mar 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 31 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![License](https://img.shields.io/:license-mit-blue.svg?style=flat-square)](https://badges.mit-license.org) ![visitors](https://visitor-badge.glitch.me/badge?page_id=anvithks.hugo-embed-pdf-shortcode)
# hugo-embed-pdf-shortcode

---
# Table of Contents

Expand All @@ -14,17 +15,40 @@

---

## Introduction
## Introduction
[\[Back to Top\]](#table-of-contents)

This is a [Hugo Shortcode](https://gohugo.io/extras/shortcodes/) developed for use in [Hugo](https://gohugo.io/) based websites. This shortcode allows you to embed a PDF file in a page on your Hugo website. It is developed using the [PDF.js](https://mozilla.github.io/pdf.js/) library by Mozilla.

![hugo-embed-pdf-shortcode cover](hugo-embed-pdf-cover.png)

## Setup
## Setup
[\[Back to Top\]](#table-of-contents)

**Note:** This shortcode is for use in Hugo based websites. It will not work anywhere else.
**Note:** This shortcode is for use in Hugo based websites. It will not work anywhere else.

Hugo embed-pdf can be installed in two ways.

### Method 1 - Install as a Git submodule

1. Add this shortcode as a Git submodule

```shell
git submodule add https://github.com/anvithks/hugo-embed-pdf-shortcode.git themes/hugo-embed-pdf-shortcode
```

2. Edit `config.toml` as follows

```
theme = ["hugo-embed-pdf-shortcode", "YourCurrentTheme"]
enableInlineShortcodes = true
```

**To learn more about "Theme components", see [the Hugo documentation](https://gohugo.io/hugo-modules/theme-components/)**

<hr />

### Method 2 - Clone this repository

1. Clone this repository
<br />
Expand Down Expand Up @@ -52,7 +76,7 @@ cp ./layouts/shortcodes/embed-pdf.html /path/to/your/hugo/website/layouts/shortc
```shell
cp -R ./static/js/pdf-js /path/to/your/hugo/website/static/js/
```
<br />
<hr />

## Usage
[\[Back to Top\]](#table-of-contents)
Expand Down Expand Up @@ -81,8 +105,11 @@ To hide loading spinner

### Parameters
- **url (required)** : The relative location of the file.

- **hidePaginator (optional)**: Boolean which expects `true` or `false`. Hides the paginator for single page documents.

- **renderPageNum (optional)**: Integer which expects any number from `1` up to the last page number in the document. Will render that specific page on initial load.

- **hideLoader (optional)**: Boolean which expects `true` or `false`. Hides the loading spinner while your document loads.

<br />
Expand Down