<% %>
被<% %>括住的内容会被ejs compiler当成javascript语句执行。使得我们可以在.ejs中使用javascript
那为什么我们不直接使用 <script>标签呢?
实际上它们存在区别,<script>中的内容本质还是你的html,也就是你点开页面view source能直接看到代码;相反,<% %>括住的内容是不会被转义成html的,它们的功能应该是辅助你书写ejs。
在<script>中使用<% %>时需要注意这点。
I want to win
缺失模块。
1、在博客根目录(注意不是yilia根目录)执行以下命令:
npm i hexo-generator-json-content --save
2、在根目录_config.yml里添加配置:
jsonContent:
meta: false
pages: false
posts:
title: true
date: true
path: true
text: true
raw: false
content: false
slug: false
updated: false
comments: false
link: false
permalink: false
excerpt: false
categories: false
tags: true