hexo-breadcrumb
Advanced tools
Comparing version 1.2.0 to 1.2.1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.register = void 0; | ||
const packageName = "hexo-breadcrumb"; | ||
const config = hexo.config; | ||
@@ -29,3 +30,4 @@ const breadcrumbConfig = hexo.config.breadcrumb; | ||
const toHTML = (links) => { | ||
const linkClassName = `breadcrumb-item`; | ||
const navId = `${packageName}`; | ||
const linkClassName = `${packageName}-item`; | ||
const navStyle = `<style> | ||
@@ -42,6 +44,7 @@ .${linkClassName} + .${linkClassName}::after { | ||
.map((link) => { | ||
return `<li class="${linkClassName}"><a href="${link.url}"><span>${link.title}</span></a></li>`; | ||
const span = `<span>${link.title}</span>`; | ||
const a = `<a href="${link.url}">${span}</a>`; | ||
return `<li class="${linkClassName}">${a}</li>`; | ||
}) | ||
.join(""); | ||
const navId = "hexo-breadcrumb"; | ||
const navAriaLabel = breadcrumbConfig.aria.nav || "Breadcrumb"; | ||
@@ -48,0 +51,0 @@ const navTag = `<nav id="${navId}" aria-label="${navAriaLabel}"><ol>${linksLi}</ol></nav>`; |
@@ -11,2 +11,3 @@ import type { | ||
const packageName = "hexo-breadcrumb"; | ||
const config = hexo.config; | ||
@@ -45,3 +46,4 @@ const breadcrumbConfig = hexo.config.breadcrumb as Breadcrumb; | ||
const toHTML = (links: Links): string => { | ||
const linkClassName = `breadcrumb-item`; | ||
const navId = `${packageName}`; | ||
const linkClassName = `${packageName}-item`; | ||
@@ -59,6 +61,7 @@ const navStyle = `<style> | ||
.map((link) => { | ||
return `<li class="${linkClassName}"><a href="${link.url}"><span>${link.title}</span></a></li>`; | ||
const span = `<span>${link.title}</span>`; | ||
const a = `<a href="${link.url}">${span}</a>`; | ||
return `<li class="${linkClassName}">${a}</li>`; | ||
}) | ||
.join(""); | ||
const navId = "hexo-breadcrumb"; | ||
const navAriaLabel = breadcrumbConfig.aria.nav || "Breadcrumb"; | ||
@@ -65,0 +68,0 @@ const navTag = `<nav id="${navId}" aria-label="${navAriaLabel}"><ol>${linksLi}</ol></nav>`; |
{ | ||
"name": "hexo-breadcrumb", | ||
"version": "1.2.0", | ||
"description": "Generate breadcrumb for a Hexo page", | ||
"version": "1.2.1", | ||
"description": "Generate breadcrumb for Hexo", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "types": "global.d.ts", |
# hexo-breadcrumb | ||
![MIT License](https://img.shields.io/npm/l/hexo-breadcrumb?style=social) | ||
![NPM Version](https://img.shields.io/npm/v/hexo-breadcrumb?style=social) | ||
[![NPM](https://img.shields.io/npm/v/hexo-breadcrumb)](https://www.npmjs.com/package/hexo-breadcrumb) | ||
[![License](https://img.shields.io/github/license/msudgh/hexo-breadcrumb)](LICENSE) | ||
A Hexo plugin to generate breadcrumbs for your posts and pages. | ||
A Hexo plugin to generate breadcrumbs for post and page layouts. | ||
## Installation | ||
## Table of Contents | ||
### Using NPM | ||
- [Features](#features) | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [Configuration](#configuration) | ||
- [Integration with Hexo themes](#integration-with-hexo-themes) | ||
- [License](#license) | ||
Install `hexo-breadcrumb` via NPM: | ||
## Features | ||
```bash | ||
npm install hexo-breadcrumb --save-dev | ||
``` | ||
- Compatible with post and page layouts. | ||
- Set custom title for the home page. | ||
- Customize delimiter and styling. | ||
- Accessible navigation with ARIA attributes of navigation. | ||
### Using Yarn | ||
## Installation | ||
Alternatively, use Yarn to add the package: | ||
1. [**ni**](https://github.com/antfu/ni): `ni hexo-breadcrumb -D` | ||
2. [**npm**](https://npmjs.com/): `npm i hexo-breadcrumb -D` | ||
3. [**yarn**](https://yarnpkg.com/): `yarn add hexo-breadcrumb -D` | ||
4. [**pnpm**](https://pnpm.io/): `pnpm add hexo-breadcrumb -D` | ||
```bash | ||
yarn add hexo-breadcrumb --dev | ||
``` | ||
## Usage | ||
@@ -30,3 +35,3 @@ | ||
In your `_config.yml` file, specify the breadcrumb settings: | ||
In `_config.yml` file, specify the breadcrumb settings as following: | ||
@@ -57,3 +62,3 @@ ```yaml | ||
### Integration | ||
### Integration with Hexo themes | ||
@@ -60,0 +65,0 @@ Add the following snippets to a layout file in order to display the breadcrumb. |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
24512
359
72
0