public function getPermalink(ItemInterface $item)
    {
        if ($item->getPath(ItemInterface::SNAPSHOT_PATH_RELATIVE_AFTER_CONVERT) === '') {
            return new Permalink('', '');
        }

        $placeholders = $this->getPlacehoders($item);
        $permalinkStyle = $this->getPermalinkAttribute($item);
        $noHtmlExtension = $this->getNoHtmlExtensionAttribute($item);

        if ($item->isBinary() === true) {
            $urlTemplate = $this::PERMALINK_NONE;
            $path = $this->generatePath($urlTemplate, $placeholders);
            $urlPath = $this->generateUrlPath($urlTemplate, $placeholders);

            return new Permalink($path, $urlPath);
        }

        switch ($permalinkStyle) {
            case 'none':
                $urlTemplate = $this::PERMALINK_NONE;
                break;
            case 'ordinal':
                if ($this->isItemWithDate($item) === true) {
                    $urlTemplate = $this::PERMALINK_ORDINAL;

                    if ($this->isCustomCollection($item)) {
                        $urlTemplate = '/:collection'.$urlTemplate;
                    }
                } else {
                    $urlTemplate = $this::PERMALINK_NONE;
                }
                break;
            case 'pretty':
                $noHtmlExtension = true;
            case 'date':
                if ($this->isItemWithDate($item) === true) {
                    $urlTemplate = $this::PERMALINK_DATE;

                    if ($this->isCustomCollection($item)) {
                        $urlTemplate = '/:collection'.$urlTemplate;
                    }
                } else {
                    $urlTemplate = $this::PERMALINK_NONE;
                }
                break;
            default:
                if ($this->templateNeedsDate($permalinkStyle) === false || $this->isItemWithDate($item) === true) {
                    $urlTemplate = $permalinkStyle;
                } else {
                    $urlTemplate = $this::PERMALINK_NONE;
                }
                break;
        }

        if ($noHtmlExtension && $placeholders[':extension'] === 'html') {
            if ($placeholders[':basename'] === 'index') {
                $placeholders[':basename'] = '';
            }

            $urlTemplate = str_replace(['.:extension', ':extension'], '', $urlTemplate);
            $pathTemplate = $urlTemplate.'/index.html';
        } else {
            $pathTemplate = $urlTemplate;
        }

        $path = $this->generatePath($pathTemplate, $placeholders);
        $urlPath = $this->generateUrlPath($urlTemplate, $placeholders);

        return new Permalink($path, $urlPath);
    }