Sling CMS 学习:Sling Content 组件及模板(三)

一,模板

模板定义:

Sling CMS 学习:Sling Content 组件及模板(三)_第1张图片



    
    
        
            
                
                
            
            
                
            
        
        
        
    

模板引用:

Sling CMS 学习:Sling Content 组件及模板(三)_第2张图片



    
        
            
            <description
                jcr:primaryType="nt:unstructured"
                sling:resourceType="sling-cms/components/editor/fields/textarea"
                label="Description"
                name="jcr:description"/>
            <taxonomy
                jcr:primaryType="nt:unstructured"
                sling:resourceType="sling-cms/components/editor/fields/taxonomy"
                label="Keywords"
                name="sling:taxonomy"/>
            <taxonomyTypeHint
                jcr:primaryType="nt:unstructured"
                sling:resourceType="sling-cms/components/editor/fields/hidden"
                name="jcr:content/sling:taxonomy@TypeHint"
                value="String[]"/>
            <canonical
                jcr:primaryType="nt:unstructured"
                sling:resourceType="sling-cms/components/editor/fields/path"
                basePath="/content"
                label="Canonical"
                name="canonical"
                titleProperty="jcr:content/jcr:title"
                type="sling:Page"/>
            <published
                jcr:primaryType="nt:unstructured"
                sling:resourceType="sling-cms/components/editor/fields/select"
                label="Published"
                name="published">
                <options jcr:primaryType="nt:unstructured">
                    <yes
                        jcr:primaryType="nt:unstructured"
                        label="Yes"
                        value="true"/>
                    <no
                        jcr:primaryType="nt:unstructured"
                        label="No"
                        value="false"/>
                </options>
            </published>
            <publishedTypeHint
                jcr:primaryType="nt:unstructured"
                sling:resourceType="sling-cms/components/editor/fields/hidden"
                name="published@TypeHint"
                value="Boolean"/>
            <hideInSitemap
                jcr:primaryType="nt:unstructured"
                sling:resourceType="sling-cms/components/editor/fields/select"
                label="Hide in Sitemap"
                name="hideInSitemap">
                <options jcr:primaryType="nt:unstructured">
                    <no
                        jcr:primaryType="nt:unstructured"
                        label="No"
                        value="false"/>
                    <yes
                        jcr:primaryType="nt:unstructured"
                        label="Yes"
                        value="true"/>
                </options>
            </hideInSitemap>
            <hideInSitemapTypeHint
                jcr:primaryType="nt:unstructured"
                sling:resourceType="sling-cms/components/editor/fields/hidden"
                name="hideInSitemap@TypeHint"
                value="Boolean"/>
            <template
                jcr:primaryType="nt:unstructured"
                sling:resourceType="sling-cms/components/editor/fields/text"
                disabled="{Boolean}true"
                label="Template"
                name="sling:template"/>
        </fields>
    </edit>
</jcr:root>
</code></pre> 
  <p>CSS and JS:</p> 
  <p>路径如下:/static/clientlibs/quincy/</p> 
  <p><a href="http://img.e-com-net.com/image/info8/cd659870dc0040b395bb6cf3b249266e.jpg" target="_blank"><img alt="Sling CMS 学习:Sling Content 组件及模板(三)_第3张图片" class="has" height="531" src="http://img.e-com-net.com/image/info8/cd659870dc0040b395bb6cf3b249266e.jpg" width="650" style="border:1px solid black;"></a></p> 
  <pre class="has"><code class="language-html"><link rel="stylesheet" href="/static/clientlibs/quincy/.../add.css" type="text/css">
<script type="text/javascript" src="/static/clientlibs/quincy/.../add.js"></script>
</code></pre> 
  <p>基本的base.jsp:</p> 
  <pre class="has"><code class="language-html"><%@include file="/libs/sling-cms/global.jsp"%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
	    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
	    <meta name="viewport" content="width=device-width, initial-scale=1" />
	    <title>Apache Sling :: ${resource.valueMap['jcr:title']}
	    
	    
	    
	    
	
	
	
		

Base Page

二,组件

Sling CMS 学习:Sling Content 组件及模板(三)_第4张图片