How to access static js file from node_modules ? #5139
Answered
by
stevenjoezhang
dimaslanjaka
asked this question in
Question / Answer
-
i cant access bootstrap css or others from /node_modules/, how to setting hexo allow accessing my _config.yml # Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/
# Site
title: "WMI"
subtitle: "Website Management Indonesia"
description: Website Management Indonesia is a blog about scripts, tips and tricks, games, software. Covering php, javascript, jquery, mysql, seo, e-commerce and others.
keywords: the legend of neverland, genshin impact, games, how to, tips and tricks, php, javascript, jquery, mysql, seo, e-commerce
timezone: "Asia/Jakarta"
language:
- en # Default language
- id # Bahasa Indonesia
- zh-TW # Traditional Chinese
- zh-CN # Simplified Chinese
- zh-HK
- th # Thailand
- tl # Filipino
# static-blog-generator multilingual ability
multilingual: true
# https://github.com/Jamling/hexo-generator-i18n
# config hexo-generator-i18n option (optional, this is default option)
## issues: ['https://github.com/hexojs/hexo/issues/4701']
i18n:
type: [page, post]
#generator: [archive, category, tag, index]
generator: []
# https://github.com/wzpan/hexo-generator-search
# https://github.com/next-theme/hexo-generator-searchdb
search:
path: search.xml
field: post
content: true
format: html
#template: ./template/search.xml
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://www.webmanajemen.com/
root: /
#permalink: :title.html #:year/:month/:day/:title.html
permalink: :title.html
permalink_defaults: :title.html
pretty_urls:
trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
trailing_html: true # Set to false to remove trailing '.html' from permalinks
# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
# Writing
new_post_name: :year/:month/:title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
# external links
external_link:
# true: Open ext in new tab, rel nofollow
enable: true
# apply resolution
## site: apply to the whole site
## post: apply only to post
field: site
# safelink, to encode all external links with outbound page (good for seo and ads)
## see: https://github.com/dimaslanjaka/safelink
safelink:
# enable salink redirector
enable: true
# exclude url to safelinkify
exclude:
- webmanajemen.com
- git.webmanajemen.com
- '**/chimeraland/recipes.html'
# skip tools
- '**/embed.html'
- '**/tools.html'
- '**/safelink.html'
# package registry
- '**/node_modules/**'
- '**/vendor/**'
# safelink url
redirect: https://www.webmanajemen.com/page/safelink.html?url=
type: base64
password: unique-password
# exclude host from external link filter
exclude:
- webmanajemen.com
- web-manajemen.blogspot.com
- dimaslanjaka.github.io
filename_case: 0
render_drafts: false
# https://hexo.io/docs/asset-folders
post_asset_folder: true
marked:
prependRoot: true
postAsset: true
relative_link: false
future: true
# https://github.com/hexojs/hexo-util
# https://hexo.io/docs/syntax-highlight.html
highlight:
enable: true
line_number: false
auto_detect: false
tab_replace: " " # replace tabs with 2 spaces
wrap: false
hljs: false
prismjs:
enable: false
preprocess: true
line_number: true
tab_replace: ""
# Home page setting
# path: Root path for your blogs index page. (default = '')
# per_page: Posts displayed per page. (0 = disable pagination)
# order_by: Posts order. (Order by date descending by default)
index_generator:
path: ""
per_page: 10
order_by: -updated #updated | date
# Category & Tag
default_category: uncategorized
default_tag:
category_map:
tag_map:
# Metadata elements
## https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
meta_generator: true
# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss
## Use post's date for updated date unless set in front-matter
updated_option: false
# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page
# Include / Exclude file(s)
## include:/exclude: options only apply to the 'source/' folder
## https://hexo.io/docs/configuration.html#Include-x2F-Exclude-Files-or-Folders
## `include` and `exclude` options only apply to the source/ folder, whereas `ignore` option applies to all folders.
include:
- "assets/adblock-notify/readme.md"
exclude:
- "**/.git*"
- "**/.git"
- "**/License.md"
- "**/frontmatter.json"
- "**/License"
- "**/bin/**"
- "**/backend/**"
- "**/MIDI.js/**"
- "**/{readme,README,changelog,CHANGELOG,license,LICENSE,License}.md"
- "**/Test/**"
- "**/guzzle/**"
- "**/exclude/**"
- "**/hexo-post-parser/**"
- "**/node_modules/**"
- "**/vendor/**"
- "**/ads/**"
- "**/tmp/**"
- "**/hexo-theme-unit-test/**"
ignore:
- "**/.git*"
# https://hexo.io/docs/configuration.html
skip_render:
- "*.html"
- "chimeraland/recipes.html"
- "_posts/chimeraland/recipes.html"
- "assets/adblock-notify/*.html"
- "page/*.html"
- "comment.html"
- "source/comment.html"
- "**/hexo-theme-unit-test/**"
- "**/node_modules/**"
- "yandex_*"
- "ahrefs_*"
- "glx_*"
- "Midi"
- "Midi/**/*"
# https://github.com/hexojs/hexo/issues/1797
- "*.json"
- "**/*.json"
- "_posts/**/*.json"
- "_posts/**/*.js"
- "_posts/**/*.css"
- "_posts/The Legend Of Neverland/Midi/readme.md"
- "**/__test__/**"
- "**/__tests__/**"
# https://www.npmjs.com/package/hexo-server
server:
port: 4000
log: false
ip: 0.0.0.0
compress: false
cache: false
header: false
serveStatic:
dotfiles: allow
extensions:
- html
- js
- css
- png
- jpg
- jpeg
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: next
# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type: git
repo: https://github.com/dimaslanjaka/dimaslanjaka.github.io.git
branch: master
message: "Git Deployment: {{ now('YYYY-MM-DD HH:mm:ss') }}"
hostname: www.webmanajemen.com
username: dimaslanjaka
email: [email protected]
author: Dimas Lanjaka
author_obj:
name: "Dimas Lanjaka"
link: "https://www.webmanajemen.com/"
image:
url: https://res.cloudinary.com/dimaslanjaka/image/fetch/https://imgdb.net/images/3600.jpg
width: 1944 # <= 600
height: 2592 # >= 60
social_links:
github: https://github.com/dimaslanjaka
youtube: https://youtube.com/p/L3n4r0x
# Feed Atom https://github.com/hexojs/hexo-generator-feed
feed:
icon: "/logo.png"
# include contents in feeds
content: true
# Generate both atom and rss2 feeds
type:
- atom
- rss2
path:
- atom.xml
- rss.xml
# https://github.com/hexojs/hexo-generator-sitemap
sitemap:
path:
- sitemap.xml
- sitemap.txt
# https://github.com/hexojs/hexo-generator-sitemap/blob/master/sitemap.xml
# template: ./sitemap_template.xml
# https://github.com/hexojs/hexo-generator-sitemap/blob/master/sitemap.txt
template_txt: ./_config_template_sitemap.txt
rel: true
tags: true
categories: true
# https://github.com/sergeyzwezdin/hexo-related-posts#Configuration
related_posts:
enabled: true
enable_env_name: prod
filter_threshold: 0.3
related_count: 3
weight:
title: 0.05
description: 0.05
keywords: 0.01
tags: 0.005
categories: 0.005
text: 1
stemmers:
- en
- ru
- id
reserved:
- asp.net
- vs.net
- ado.net
- .net
- games
- js
- ts
# https://github.com/CHENXCHEN/hexo-renderer-markdown-it-plus.git
markdown_it_plus:
highlight: true
html: true
xhtmlOut: true
breaks: true
langPrefix:
linkify: true
typographer:
#quotes: “”‘’
pre_class: highlight
plugins:
- plugin:
# https://www.npmjs.com/package/markdown-it-attrs
name: markdown-it-attrs
enable: true
options:
leftDelimiter: "{"
rightDelimiter: "}"
allowedAttributes: [] # empty array = all attributes are allowed
# https://github.com/hexojs/hexo-browsersync
browsersync:
logLevel: "warn"
ghostMode:
scroll: true
instanceName: "customInstance"
port: 3001
browser: "firefox"
open: false
# static-blog-generator
generator:
cache: true
type: hexo
copy:
posts:
space: true
# https://www.npmjs.com/package/hexo-excerpt
excerpt:
depth: 10
excerpt_excludes: []
more_excludes: []
hideWholePostExcerpts: false
## https://github.com/dimaslanjaka/hexo-adsense
adsense:
enable: false
#pub: ca-pub-1165447249910969 # mine
#pub: ca-pub-2188063137129806 # kiki
pub: ca-pub-2974518380815858
# in-article ads source
article_ads:
#- "source/ads/in_article.html"
#- "source/ads/in_article2.html"
# ads field
field: "site" # post=only post, site=all pages and posts
# auto redirect to https
https: false
# block user with adblock enabled
adblock: false
# amp or javascript
type: javascript
# exclude pattern, disable adding adsense
exclude:
- "*.min.html"
- "**/exclude/**/*"
## https://github.com/dimaslanjaka/hexo-generator-redirect
redirect:
enable: true
# next project: hexo-analytics
analytics:
# google tag manager
tagmanager: GTM-NJNNXSR
# google analytics v4
GA4: G-BG75CLNJZ1
# google analytics
GA3: UA-106238155-1
# cloudflare web statistics
cloudflare: 2157c0f3b9e74a92badffe39156166b9
# https://github.com/dimaslanjaka/hexo-seo
seo:
html:
# fix invalid html
fix: true
# exclude from minify
exclude:
- "*.min.{htm,html}"
css: true
js: true
schema: false
img:
# fix broken images
broken: false
# default broken images
default: https://upload.wikimedia.org/wikipedia/commons/6/65/No-Image-Placeholder.svg
# broken images methods
# serverside : process broken images from server side (caused javascript heap out of memory, if your post large and your device has insufficient memory)
# clientside : process broken image from client side browser with webjs
onerror: serverside
# external links fix
links:
# enable or false
enable: true
# allowed following links, otherwise nofollow others
exclude:
- webmanajemen.com
- web-manajemen.blogspot.com
- dimaslanjaka.github.io
sitemap: true
## Categories and Tags mapper
### Assign existing tag to new tag
tag_assign:
### Assign existing category to new category
category_assign:
TS: Programming
JS: Programming
Typescript: Programming
Javascript: Programming
GitHub: Programming
### Replace Tag to New Tag
tag_mapper:
JS: Javascript
TS: Typescript
### Replace Category to New Category
category_mapper:
JS: Javascript
TS: Typescript |
Beta Was this translation helpful? Give feedback.
Answered by
stevenjoezhang
Jul 28, 2023
Replies: 1 comment 2 replies
-
You can write a custom generator plugin |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For example: