Skip to content

Instantly share code, notes, and snippets.

@mersy
Last active December 25, 2015 18:49
Show Gist options
  • Save mersy/7023856 to your computer and use it in GitHub Desktop.
Save mersy/7023856 to your computer and use it in GitHub Desktop.
dataapifocategory
var api = new MT.DataAPI({
baseUrl: "<mt:Var name="website_url">mersy-movabletype/mt-data-api.cgi",
clientId: "1234567890"
});
var params = {
//limit: 10,
fields: "id,title,permalink,date,categories"
};
getApiEntries (2, params, pageTitle);
function setHTML (entryData) {
var oldStr = entryData.date;
var newStr = oldStr.replace(/(\d{4})-(\d{2})-(\d{2}).*/,"$1年$2月$3日");
return [
'<li>',
'<time datetime="' + entryData.date + '">' + newStr + '</time>',
'<a href="' + entryData.permalink + '">' + entryData.title + '</a>',
'</li>'
].join("");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment