Skip to content

Latest commit

 

History

History
96 lines (66 loc) · 3.3 KB

README.md

File metadata and controls

96 lines (66 loc) · 3.3 KB

hexo-absolute

GitHub Tag GitHub Release GitHub commits since latest release GitHub top language Coverage Status CI Libraries.io dependency status for GitHub repo

Convert relative path to absolute URL for hexo

Only run when hexo generate or deploy, won't run when hexo server.

Install

NPM Version node-lts NPM License NPM Downloads NPM Downloads Libraries.io dependency status for latest release

pnpm add hexo-absolute

# npm i hexo-absolute

Configuration

Website Configuration

# If your website is in a subdirectory (such as http://example.org/blog) set url to http://example.org/blog and set root to /blog/.
url: http://example.org/blog

Hexo/Docs/Configuration#URL

Plugin Configuration

absolute:
  enable: true
  tagName: ["a", "link", "img", "script"]
  attribute: ["href", "src"]
  priority: 20

Example (default config)

before

<a href="#top">top</a>
<link rel="stylesheet" href="/css/style.css" />
<img src="/images/hexo.png" />
<script src="/js/jquery-2.2.4.min.js"></script>

after

<a href="https://example.org/#top">top</a>
<link rel="stylesheet" href="https://example.org/css/style.css" />
<img src="https://example.org/images/hexo.png" />
<script src="https://example.org/js/jquery-2.2.4.min.js"></script>

Uninstall

pnpm rm hexo-absolute

# npm uninstall hexo-absolute