哪些CMS系统可以使用静态代码?
What CMS systems can be used with static code?
我知道这不是一个编码问题,但我一直在谷歌搜索和谷歌搜索,我似乎可以找到关于这个主题的任何东西...如果你愿意,我可以删除这个 post,但是我真的非常想知道,所以请试一试!
我有一个我一直在制作的网站(只写 HTML 和 CSS),我想要一个博客页面,我希望不必重写每次写博客时都会编写代码 post,但我不想为我的整个网站使用 CMS。有没有办法只为一页使用 CMS?或者以某种方式简化它的其他方法?
感谢您的宝贵时间!
在我看来,您应该关注一个更动态的数据系统。 CMS 是一个简单的解决方案,但可能是一种臃肿的方法。
如果您只是希望能够使用静态页面模板并动态填充数据,您可以使用简单的 JSON 文件或 XML。
您使用的是 Javascript,更具体地说是 Angular 还是 jQuery?
可能有成千上万种方法可以做到这一点,但如果没有更好的项目细节,那就有点像掷硬币了。
一个非常简单的解决方案是简单地创建一个 AngularJS 组件并将其粘贴在您的单个博客页面中 html。然后,仅使用外部 JSON 文件,您可以将所有博客文章动态填充到单个模板文件中。
HTML:
<div ng-app='app' ng-controller='mainCtrl'>
<div ng-repeat="blog in myJson" class="blog-post">
<ul class="blog-list">
<li class="blog-post-item">
<h3>{{blog.title}}</h3>
<p>{{blog.body}}</p>
<p>{{blog.date}}</p>
<p>{{blog.misc}}</p>
</li>
</ul>
</div>
</div>
Javascript:
angular.module('app',['QuickList']).controller('mainCtrl', function($scope){
$scope.myJson = [{
title: "Some title here",
body: "Main blog post body here with <b> html content </b>",
date: "Jan, 1, 2016",
misc: "other info"
},{
title: "Some title here 2",
body: "Main blog post body here with <b> html content </b>",
date: "Jan, 1, 2016",
misc: "other info"
},{
title: "Some title here 3",
body: "Main blog post body here with <b> html content </b>",
date: "Jan, 1, 2016",
misc: "other info"
},{
title: "Some title here 4",
body: "Main blog post body here with <b> html content </b>",
date: "Jan, 1, 2016",
misc: "other info"
}]
})
并确保在您的 index.html
中包含 angular 来源
试试 perch,它非常适合这个用例。
我知道这不是一个编码问题,但我一直在谷歌搜索和谷歌搜索,我似乎可以找到关于这个主题的任何东西...如果你愿意,我可以删除这个 post,但是我真的非常想知道,所以请试一试!
我有一个我一直在制作的网站(只写 HTML 和 CSS),我想要一个博客页面,我希望不必重写每次写博客时都会编写代码 post,但我不想为我的整个网站使用 CMS。有没有办法只为一页使用 CMS?或者以某种方式简化它的其他方法?
感谢您的宝贵时间!
在我看来,您应该关注一个更动态的数据系统。 CMS 是一个简单的解决方案,但可能是一种臃肿的方法。
如果您只是希望能够使用静态页面模板并动态填充数据,您可以使用简单的 JSON 文件或 XML。
您使用的是 Javascript,更具体地说是 Angular 还是 jQuery?
可能有成千上万种方法可以做到这一点,但如果没有更好的项目细节,那就有点像掷硬币了。
一个非常简单的解决方案是简单地创建一个 AngularJS 组件并将其粘贴在您的单个博客页面中 html。然后,仅使用外部 JSON 文件,您可以将所有博客文章动态填充到单个模板文件中。
HTML:
<div ng-app='app' ng-controller='mainCtrl'>
<div ng-repeat="blog in myJson" class="blog-post">
<ul class="blog-list">
<li class="blog-post-item">
<h3>{{blog.title}}</h3>
<p>{{blog.body}}</p>
<p>{{blog.date}}</p>
<p>{{blog.misc}}</p>
</li>
</ul>
</div>
</div>
Javascript:
angular.module('app',['QuickList']).controller('mainCtrl', function($scope){
$scope.myJson = [{
title: "Some title here",
body: "Main blog post body here with <b> html content </b>",
date: "Jan, 1, 2016",
misc: "other info"
},{
title: "Some title here 2",
body: "Main blog post body here with <b> html content </b>",
date: "Jan, 1, 2016",
misc: "other info"
},{
title: "Some title here 3",
body: "Main blog post body here with <b> html content </b>",
date: "Jan, 1, 2016",
misc: "other info"
},{
title: "Some title here 4",
body: "Main blog post body here with <b> html content </b>",
date: "Jan, 1, 2016",
misc: "other info"
}]
})
并确保在您的 index.html
中包含 angular 来源试试 perch,它非常适合这个用例。