Skip to main content
All CollectionsAuthor HelpMarkdown and Markua
How to Create and Publish a Sample Book
How to Create and Publish a Sample Book

Keywords: book, ebook, sample, sample book, how

Leanpub Support avatar
Written by Leanpub Support
Updated over a month ago
How to Create and Publish a Sample Book

Publishing a sample book is a great way to encourage readers to buy your book!

It lets people download a subset of your book, selected by you, to let them know what your book is like.

When it's published, the sample book will appear for viewing on your book's landing page, like this:

By clicking "Read Free Sample", readers will be able to view the sample book in the available formats:

The Two Different Ways to Publish a Sample Book

There are two ways to publish a sample book:

1) Using our Upload writing mode

2) Using one of our own book generation writing modes (Browser, GitHub, or Dropbox)

We will set out the instructions for these two ways to publish a sample book in the sections below.

Uploading a Sample Book in the Upload Writing Mode

If you've already published a book in our Upload writing mode, you'll be familiar with the box where you can upload your sample book files:

If your book is already published, all you need to do is upload your sample book files there, and they'll be published automatically!

And if you're book has not been published yet, when you do ahead and publish it for the first time, the sample book file or files you upload will be available on your book's landing page.

Publishing a Sample Book in Browser, GitHub, or Dropbox Writing Mode

If you are not using the Upload writing mode, and you are writing your book manuscript on Leanpub using Markua, then you use the sample book directives to choose what sections and subsections to include in the sample book, and what to exclude in the sample book.

All your chapter titles will appear in the sample book, but only chapters you choose to include in the sample book will have the chapter contents appear in the sample book.

The two sample book directives are:

{sample: true}

...and

{sample: false}

Using {sample: true} to include a section in your sample book

To include a section in your sample book, you write this above the section header, on a line by itself:

{sample: true}

For example, if you had a section called # Chapter One in your book, you would include it in the sample like this:

{sample: true}
# Chapter One

Call me Ishmael. Some years ago—never mind how long precisely— having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. It is a way I have of driving off the spleen and regulating the circulation.

Note that this will include all subsections of the # Chapter One` section in the sample book.


Using {sample: false} to exclude a subsection in your sample book

If You have a subsection that you want to exclude from your sample book, you write this above the subsection header, on a line by itself:

{sample: false}

For example, if you had a subsection called ## Subsection One in your book, you would exclude it from the sample like this:

{sample: true}
# Chapter One

Call me Ishmael. Some years ago—never mind how long precisely— having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. It is a way I have of driving off the spleen and regulating the circulation.

{sample: false}
## Subsection One

Whenever I find myself growing grim about the mouth; whenever it is a damp, drizzly November in my soul; whenever I find myself involuntarily pausing before coffin warehouses, and bringing up the rear of every funeral I meet; and especially whenever my hypos get such an upper hand of me, that it requires a strong moral principle to prevent me from deliberately stepping into the street, and methodically knocking people’s hats off—then, I account it high time to get to sea as soon as I can. This is my substitute for pistol and ball.

Selecting Chapters to Include in the Sample Book

Here is an example of a book with three chapters, in our Browser writing mode:

To include the first chapter in the sample, you write the {sample: true} directive on the line above the chapter heading, like this:

Now, when you generate a preview, you will see that there are sample book file links for you to view:

In the sample book, the Table of Contents will look the same as it does in the full book, so people get a sense of the whole book:

If we go to Chapter One, we'll see that its contents are included in the sample book:

However, Chapter Two and Chapter Three will include the chapter title, but not the chapter contents.

Instead of the chapter contents, readers will see a little message explaining that the content is not available in the sample book, with a link to the book landing page, in case they found this sample book somewhere else on the web, for example on your own personal or business website:

Publish Your Book to Get the Sample to Appear on the Book's Landing Page

You will need to publish a new version of your book (or publish it for the first time) to get your book sample to appear on the landing page.

Once the publish process is complete, people will see the link to download the sample book, if they go to your book landing page:

Note: We used OpenAI services to create some of the content in this article, including the cover image and the example text.


If you have any feedback or questions about this article, please email the Leanpub team about it at hello@leanpub.com!

If you have any questions or thoughts on writing and self-publishing with Leanpub, please join our global community of authors in our Authors Forum here!

Are you interested in self-publishing, and creating your first Leanpub book? Here are some quick tutorials for our most popular writing modes: http://help.leanpub.com/en/articles/3088382-quick-walkthroughs-for-getting-started-on-a-leanpub-book

Are you looking for great deals on Leanpub ebooks, ebook bundles, and courses? Sign up for our Weekly and Monthly newsletter sales here!

To learn about amazing new books and authors, subscribe to our YouTube channel here: https://www.youtube.com/leanpub.

You can also follow Leanpub in lots of other places!

Did this answer your question?