freemarker 定义公共header

<#--公共顶部-->  
<#macro header title="默认文字" keywords="默认文字" description="默认文字">  
<!DOCTYPE html>  
<html>  
    <head lang="en">  
        <meta charset="UTF-8">  
        <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;" />  
        <meta name="format-detection" content="telephone=no" />  
        <title>${title}</title>  
        <meta name="keywords" content="${keywords}" />  
        <meta name="description" content="${description}" />  
          
        <link rel="stylesheet" type='text/css' href="/static/style/common.css"/>  
          
        <#nested>  
          
    </head>  
    <body>  
</#macro>  
  
<#--公共底部-->  
<#macro footer>  
  
    <script type="text/javascript" src="/static/js/common.js"></script>  
      
    <#nested>  
      
    </body>  
</html>  
</#macro>  

使用 macro 定义一个宏。。以后可以直接使用ok
<#include '页面路径'>
原文地址:https://www.cnblogs.com/whm-blog/p/7049052.html