如果您的用例和我的一样,并且您想在模板中包含 add'l 内容,您可以使用 YAML 的块标量功能将来自前端的多行内容包含到模板中。A|
保留换行符,而 a>
删除(“折叠”)换行符。(请注意,块指示符后面必须有一个空行。)
索引.html
---
layout: default
head: |
<link href="//cdn-images.mailchimp.com/embedcode/classic-081711.css" rel="stylesheet" type="text/css">
<style type="text/css">
#mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }
</style>
script: |
<script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'></script>
<script type='text/javascript'>(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='LNAME';ftypes[2]='text';fnames[3]='PHONE';ftypes[3]='phone';fnames[4]='ORG';ftypes[4]='text';fnames[5]='MMERGE5';ftypes[5]='text';}(jQuery));var $mcj = jQuery.noConflict(true);</script>
---
<!-- Content, maybe a MailChimp signup form? -->
默认.html
<!DOCTYPE html>
<html>
<head>
<title>
{{page.title}}
</title>
<link rel="stylesheet" type="text/css" href="/css/main.css">
<!-- here you can have add'l arbitrary head content -->
{{ page.head }}
</head>
<body>
{{content}}
<script>
// Google Analytics, perhaps?
</script>
<!-- here you can have add'l arbitrary content at the end of the page, good for scripts -->
{{page.script}}
</body>
</html>