protected function createNCX( $book_contents, $metadata ) {

		if ( empty( $this->manifest ) ) {
			throw new \Exception( '$this->manifest cannot be empty. Did you forget to call $this->createOEBPS() ?' );
		}

		// Sanitize variables for usage in XML template
		$vars = [
			'author' => ! \Pressbooks\Utility\empty_space( $metadata['pb_authors'] ) ? sanitize_xml_attribute( oxford_comma_explode( $metadata['pb_authors'] )[0] ) : '',
			'manifest' => $this->manifest,
			'dtd_uid' => ! empty( $metadata['pb_ebook_isbn'] ) ? sanitize_xml_attribute( $metadata['pb_ebook_isbn'] ) : sanitize_xml_attribute( get_bloginfo( 'url' ) ),
			'enable_external_identifier' => false,
			'lang' => $this->lang,
		];

		\Pressbooks\Utility\put_contents(
			$this->tmpDir . '/toc.xhtml',
			$this->loadTemplate( $this->dir . '/templates/epub3/toc.php', $vars )
		);

		// For backwards compatibility
		\Pressbooks\Utility\put_contents(
			$this->tmpDir . '/toc.ncx',
			$this->loadTemplate( $this->dir . '/templates/epub201/ncx.php', $vars )
		);
	}