Guides and Sample Code

Developer

Apple News Format: Design Tutorial

On This Page

Article Template

This section brings together all of the Apple News Format features from this tutorial, as a template that you can use for your News articles. If you followed the steps throughout this tutorial, the code in this template should match the code in your article.json file.

JSON Article Template

You can copy or download this template (the article.json file in News_Design_Tutorial_6_Embeds) and modify it to create your own News articles; see Downloading the Article Bundle Examples. To preview this article, see Previewing the Article Bundle Examples.

Example Code

  1. {
  2. "title": "Article Title",
  3. "metadata": {
  4. "thumbnailURL": "bundle://header.jpg",
  5. "excerpt": "Quia consequuntur magni accusantium doloremque eos qui ratione voluptatem sequi nesciunt?"
  6. },
  7. "version": "1.5",
  8. "identifier": "testArticle",
  9. "language": "en",
  10. "layout": {
  11. "columns": 10,
  12. "width": 1024,
  13. "margin": 85,
  14. "gutter": 20
  15. },
  16. "documentStyle": {
  17. "backgroundColor": "#F5F9FB"
  18. },
  19. "components": [
  20. {
  21. "role": "heading1",
  22. "layout": "heading1Layout",
  23. "text": "HEADING"
  24. },
  25. {
  26. "role": "divider",
  27. "layout": "bigDividerLayout",
  28. "stroke": {
  29. "width": 3,
  30. "color": "#D5B327"
  31. }
  32. },
  33. {
  34. "role": "title",
  35. "layout": "halfMarginBelowLayout",
  36. "text": "ARTICLE TITLE"
  37. },
  38. {
  39. "role": "intro",
  40. "layout": "halfMarginBelowLayout",
  41. "text": "Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque ipsum?"
  42. },
  43. {
  44. "role": "byline",
  45. "layout": "fullMarginBelowLayout",
  46. "text": "By Urna Semper"
  47. },
  48. {
  49. "role": "photo",
  50. "layout": "fullBleedLayout",
  51. "caption": "A caption for the photo.",
  52. "URL": "bundle://header.jpg"
  53. },
  54. {
  55. "role": "caption",
  56. "layout": "halfMarginBothLayout",
  57. "text": "ABOVE: A caption for the photo (Attribution)"
  58. },
  59. {
  60. "role": "divider",
  61. "layout": "fullMarginBelowLayout",
  62. "stroke": {
  63. "width": 1,
  64. "color": "#D5B327"
  65. }
  66. },
  67. {
  68. "role": "body",
  69. "format": "html",
  70. "layout": "noMarginLayout",
  71. "textStyle": "bodyFirstDropCap",
  72. "text": "<p>Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, dolor repellendus. <a href='http://www.apple.com'>Link text</a> quibusdam et aut.</p><p>Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, adipisci velit.</p>"
  73. },
  74. {
  75. "role": "heading2",
  76. "layout": "fullMarginAboveHalfBelowLayout",
  77. "text": "HEADING"
  78. },
  79. {
  80. "role": "body",
  81. "format": "html",
  82. "layout": "noMarginLayout",
  83. "text": "Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? At vero eos et accusamus et iusto odio ducimus qui blanditiis."
  84. },
  85. {
  86. "role": "divider",
  87. "layout": "fullMarginAboveLayout",
  88. "stroke": {
  89. "width": 1,
  90. "color": "#D5B327"
  91. }
  92. },
  93. {
  94. "role": "pullquote",
  95. "layout": "halfMarginAboveQuarterBelowLayout",
  96. "text": "“QUIA CONSEQUUNTUR MAGNI DOLORES EOS QUI RATIONE VOLUPTATEM SEQUI NESCIUNT.”"
  97. },
  98. {
  99. "role": "pullquote",
  100. "layout": "halfMarginBelowLayout",
  101. "textStyle": "attribution",
  102. "text": "— ATTRIBUTION"
  103. },
  104. {
  105. "role": "divider",
  106. "layout": "fullMarginBelowLayout",
  107. "stroke": {
  108. "width": 1,
  109. "color": "#D5B327"
  110. }
  111. },
  112. {
  113. "role": "body",
  114. "format": "html",
  115. "layout": "noMarginLayout",
  116. "text": "<p>Cras ultricies mi eu turpis hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer.</p><p>Temporibus autem et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque rerum hic tenetur.</p><p>Inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo esciunt enim ipsam voluptatem quia.</p><p>Ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis <a href='http://www.apple.com'>link text</a> repellat. Sed ut perspiciatis unde omnis iste natus sit voluptatem accusantium doloremque, totam rem aperiam, eaque ipsa quae ab illo inventore.</p><p>Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni.</p>"
  117. },
  118. {
  119. "role": "heading2",
  120. "layout": "fullMarginAboveHalfBelowLayout",
  121. "text": "HEADING"
  122. },
  123. {
  124. "role": "body",
  125. "format": "html",
  126. "layout": "noMarginLayout",
  127. "text": "Sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas."
  128. },
  129. {
  130. "role": "heading2",
  131. "layout": "fullMarginAboveHalfBelowLayout",
  132. "text": "GALLERY HEADING"
  133. },
  134. {
  135. "role": "gallery",
  136. "layout": "noMarginLayout",
  137. "items": [
  138. {
  139. "URL": "bundle://gallery-01.jpg",
  140. "caption": "A caption for the first image in the gallery."
  141. },
  142. {
  143. "URL": "bundle://gallery-02.jpg",
  144. "caption": "A caption for the second image in the gallery."
  145. },
  146. {
  147. "URL": "bundle://gallery-03.jpg",
  148. "caption": "A caption for the third image in the gallery."
  149. }
  150. ]
  151. },
  152. {
  153. "role": "caption",
  154. "layout": "halfMarginBothLayout",
  155. "text": "ABOVE: A caption for the entire gallery. Individual photos in the gallery also have their own captions. (Shared attribution)"
  156. },
  157. {
  158. "role": "divider",
  159. "layout": "fullMarginBelowLayout",
  160. "stroke": {
  161. "width": 1,
  162. "color": "#D5B327"
  163. }
  164. },
  165. {
  166. "role": "body",
  167. "format": "html",
  168. "layout": "noMarginLayout",
  169. "text": "Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas est, omnis dolor repellendus."
  170. },
  171. {
  172. "role": "heading2",
  173. "layout": "fullMarginAboveHalfBelowLayout",
  174. "text": "MOSAIC HEADING"
  175. },
  176. {
  177. "role": "mosaic",
  178. "layout": "noMarginLayout",
  179. "items": [
  180. {
  181. "URL": "bundle://mosaic-01.jpg",
  182. "caption": "A caption for the first image in the mosaic."
  183. },
  184. {
  185. "URL": "bundle://mosaic-02.jpg",
  186. "caption": "A caption for the second image in the mosaic."
  187. },
  188. {
  189. "URL": "bundle://mosaic-03.jpg",
  190. "caption": "A caption for the third image in the mosaic."
  191. },
  192. {
  193. "URL": "bundle://mosaic-04.jpg",
  194. "caption": "A caption for the fourth image in the mosaic."
  195. },
  196. {
  197. "URL": "bundle://mosaic-05.jpg",
  198. "caption": "A caption for the fifth image in the mosaic."
  199. }
  200. ]
  201. },
  202. {
  203. "role": "caption",
  204. "layout": "halfMarginBothLayout",
  205. "text": "ABOVE: A caption for the entire mosaic. Individual photos in the mosaic also have their own captions. (Shared attribution)"
  206. },
  207. {
  208. "role": "divider",
  209. "layout": "noMarginLayout",
  210. "stroke": {
  211. "width": 1,
  212. "color": "#D5B327"
  213. }
  214. },
  215. {
  216. "role": "heading2",
  217. "layout": "fullMarginAboveHalfBelowLayout",
  218. "text": "HEADING"
  219. },
  220. {
  221. "role": "body",
  222. "format": "html",
  223. "layout": "noMarginLayout",
  224. "text": "<p>Consequatur aut doloribus asperiores repellat. Sed ut perspiciatis unde omnis iste natus error sit volup tatem accusantium doloremque laudantium, totam rem, eaque ipsa quae ab illo inventore veritatis et quasi archit ecto beatae vitae.</p><p>Nemo enim ipsam volup tatem quia voluptas sit aspernatur aut odit aut fugit, sed quia conse quuntur magni. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam.</p><p>Consequatur aut perferendis doloribus asperiores repellat. Sed ut perspiciatis unde omnis iste natus error sit volup tatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi archit ecto beatae vitae dicta. Nemo enim ipsam volup tatem quia voluptas sit <a href='http://www.apple.com'>link text</a> aut odit aut fugit, sed quia conse quuntur perspiciatis doloribus magni dolores.</p><p>Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam suscipit laboriosam.</p>"
  225. },
  226. {
  227. "role": "heading2",
  228. "layout": "fullMarginAboveHalfBelowLayout",
  229. "text": "MAP HEADING"
  230. },
  231. {
  232. "role": "map",
  233. "layout": "noMarginLayout",
  234. "mapType": "hybrid",
  235. "caption": "Map caption",
  236. "latitude": 35.065908,
  237. "longitude": -109.781623,
  238. "span": {
  239. "latitudeDelta": 5,
  240. "longitudeDelta": 5
  241. },
  242. "items": [
  243. {
  244. "caption": "A caption for this map pin",
  245. "latitude": 35.065908,
  246. "longitude": -109.781623
  247. }
  248. ]
  249. },
  250. {
  251. "role": "heading2",
  252. "layout": "fullMarginAboveHalfBelowLayout",
  253. "text": "HEADING"
  254. },
  255. {
  256. "role": "body",
  257. "format": "html",
  258. "layout": "noMarginLayout",
  259. "text": "Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? At vero eos et accusamus et iusto odio. Dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati."
  260. },
  261. {
  262. "role": "heading2",
  263. "layout": "fullMarginAboveHalfBelowLayout",
  264. "text": "TWEET HEADING"
  265. },
  266. {
  267. "role": "tweet",
  268. "layout": "noMarginLayout",
  269. "URL": "https://twitter.com/Urna_Semper/status/750424743417745408"
  270. }
  271. ],
  272. "textStyles": {},
  273. "componentLayouts": {
  274. "noMarginLayout": {
  275. "columnStart": 0,
  276. "columnSpan": 7
  277. },
  278. "heading1Layout": {
  279. "columnStart": 0,
  280. "columnSpan": 7,
  281. "margin": {
  282. "top": 24,
  283. "bottom": 3
  284. }
  285. },
  286. "halfMarginBelowLayout": {
  287. "columnStart": 0,
  288. "columnSpan": 7,
  289. "margin": {
  290. "bottom": 12
  291. }
  292. },
  293. "fullMarginBelowLayout": {
  294. "columnStart": 0,
  295. "columnSpan": 7,
  296. "margin": {
  297. "bottom": 24
  298. }
  299. },
  300. "fullMarginAboveHalfBelowLayout": {
  301. "columnStart": 0,
  302. "columnSpan": 7,
  303. "margin": {
  304. "top": 24,
  305. "bottom": 12
  306. }
  307. },
  308. "bigDividerLayout": {
  309. "ignoreDocumentMargin": "right",
  310. "columnStart": 0,
  311. "columnSpan": 10,
  312. "margin": {
  313. "top": 6,
  314. "bottom": 6
  315. }
  316. },
  317. "fullBleedLayout": {
  318. "ignoreDocumentMargin": true
  319. },
  320. "halfMarginBothLayout": {
  321. "columnStart": 0,
  322. "columnSpan": 7,
  323. "margin": {
  324. "top": 12,
  325. "bottom": 12
  326. }
  327. },
  328. "fullMarginAboveLayout": {
  329. "columnStart": 0,
  330. "columnSpan": 7,
  331. "margin": {
  332. "top": 24
  333. }
  334. },
  335. "halfMarginAboveQuarterBelowLayout": {
  336. "columnStart": 0,
  337. "columnSpan": 7,
  338. "margin": {
  339. "top": 12,
  340. "bottom": 6
  341. }
  342. }
  343. },
  344. "componentStyles": {},
  345. "componentTextStyles": {
  346. "default": {
  347. "fontName": "DINAlternate-Bold",
  348. "textColor": "#222222",
  349. "fontSize": 16,
  350. "lineHeight": 22,
  351. "linkStyle": {
  352. "textColor": "#D5B327"
  353. }
  354. },
  355. "default-body": {
  356. "fontName": "IowanOldStyle-Roman",
  357. "paragraphSpacingBefore": 12,
  358. "paragraphSpacingAfter": 12
  359. },
  360. "default-title": {
  361. "fontName": "DINAlternate-Bold",
  362. "fontSize": 42,
  363. "lineHeight": 44,
  364. "textColor": "#53585F"
  365. },
  366. "default-intro": {
  367. "fontName": "DINAlternate-Bold",
  368. "fontSize": 18,
  369. "lineHeight": 22,
  370. "textColor": "#A6AAA9"
  371. },
  372. "default-byline": {
  373. "fontName": "DINAlternate-Bold",
  374. "fontSize": 15,
  375. "lineHeight": 18,
  376. "textColor": "#53585F"
  377. },
  378. "default-heading2": {
  379. "fontName": "DINAlternate-Bold",
  380. "tracking": 0.05,
  381. "textColor": "#53585F"
  382. },
  383. "default-heading1": {
  384. "fontName": "DINAlternate-Bold",
  385. "tracking": 0.12,
  386. "textColor": "#53585F"
  387. },
  388. "bodyFirstDropCap": {
  389. "dropCapStyle": {
  390. "fontName": "DINAlternate-Bold",
  391. "textColor": "#A6AAA9",
  392. "numberOfLines": 2
  393. }
  394. },
  395. "default-caption": {
  396. "fontName": "IowanOldStyle-Italic",
  397. "fontSize": 12,
  398. "lineHeight": 16,
  399. "paragraphSpacingBefore": 12,
  400. "paragraphSpacingAfter": 12,
  401. "textColor": "#53585F"
  402. },
  403. "default-pullquote": {
  404. "fontName": "DINAlternate-Bold",
  405. "fontSize": 30,
  406. "lineHeight": 36,
  407. "textColor": "#A6AAA9",
  408. "hangingPunctuation": true
  409. },
  410. "attribution": {
  411. "fontName": "DINAlternate-Bold",
  412. "fontSize": 12,
  413. "lineHeight": 16,
  414. "tracking": 0.12,
  415. "textColor": "#53585F",
  416. "textAlignment": "right"
  417. }
  418. }
  419. }

Further Exploration

To keep learning about Apple News Format, see More Resources.