Support » Plugin: Publish To Apple News » Text may contain HTML tags — caused by ampersand

  • Resolved jcovert


    I just recently installed the latest copy of the plugin on WordPress 4.9.8. I am having a problem wherein ampersands are showing up in Apple News as HTML. This is resulting in a “text may contain HTML tags” error. The offending ampersands were used in body text as well as captions. Both instances seem to be causing issues. Any ideas?

    Also worth noting… I initially had an error regarding “invalid layout” reported by Apple that was being caused by the string “[]” being passed for the layout property “ignoreDocumentMargin” specifically related to image captions. I should note that I have the “Use Full-Bleed Images?” setting set to “no”. In a nutshell, every article with an image and caption was being rejected for this reason. To resolve I simply editing the JSON for the “default” theme using the Custom JSON feature to hard code a working value for this property (probably not ideal), as follows:

    { "role": "container", "components": [ { "role": "photo", "URL": "#url#", "layout": "#layout#", "caption": "#caption#" }, { "role": "caption", "text": "#caption#", "textStyle": { "textAlignment": "#text_alignment#", "fontName": "#caption_font#", "fontSize": "#caption_size#", "tracking": "#caption_tracking#", "lineHeight": "#caption_line_height#", "textColor": "#caption_color#" }, "layout": { "margin": { "top": 0 }, "ignoreDocumentMargin": false } } ], "layout": { "ignoreDocumentMargin": false } }

    Thank you for kind assistance, and for building such a useful plugin.

    • This topic was modified 1 year, 3 months ago by jcovert.
    • This topic was modified 1 year, 3 months ago by jcovert.
    • This topic was modified 1 year, 3 months ago by jcovert.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Kevin Fodness


    Hi @jcovert

    Can you run through the instructions here please:

    Getting the details about the content you are trying to publish will allow me to attempt to reproduce the issue on my end, both for the ampersand issue and the ignoreDocumentMargin issue.

    If you are using WordPress 5.0 and the Gutenberg editor (the new block editor in WordPress) also please let me know.


    I am using WordPress 4.9.8. The default WordPress editor is being used. I have the plugin set to “Enable HTML Support” = yes

    I have received no errors during publishing within WordPress including within the plugin’s UI. On the Apple News side the articles all seem to be rendering very well with the only exception being when we use an ampersand within a caption of an image. When an ampersand is used in the caption Apple rejects the article stating that we are passing raw HTML.

    As an example:

    WordPress Article:

    In this article the phrase “S&P” is used several times between the main body content and a caption. Within Apple News Publisher I am being told that I am displaying HTML because the “&” used in the image caption specifically is rendering as HTML. I have visually confirmed this within the Apple News mobile app. Oddly, the “&” used within the rest of the body copy is not a problem.

    The output JSON from the plugin is the following for the same article:

    {"version":"1.7","identifier":"post-29337","language":"en-US","title":"Sellers Keep Market on Pace for Terrible Quarter","documentStyle":{"backgroundColor":"#fafafa"},"layout":{"columns":7,"width":1024,"margin":60,"gutter":20},"components":[{"role":"header","layout":"headerPhotoLayout","components":[{"role":"photo","layout":"headerPhotoLayout","URL":"bundle:\/\/mama_bears_cubs_ThinkstockPhotos-866119234.jpg"}],"behavior":{"type":"parallax","factor":0.8}},{"role":"container","layout":{"columnSpan":7,"columnStart":0,"ignoreDocumentMargin":true},"style":{"backgroundColor":"#fafafa"},"components":[{"role":"title","text":"Sellers Keep Market on Pace for Terrible Quarter","format":"html","textStyle":"default-title","layout":"title-layout"},{"role":"byline","text":"by David Russell | Dec 17, 2018 | 7:33 AM","textStyle":"default-byline","layout":"byline-layout"},{"role":"body","text":"<p>Bears continued to hammer stocks last week, keeping the market on pace for its worst quarter since early this decade.<\/p>","format":"html","textStyle":"dropcapBodyStyle","layout":"body-layout"},{"role":"body","text":"<p>The S&P 500 attempted a feeble bounce before rolling over and closing at its lowest level since April. All told, it declined 1.2 percent between Friday, December 7, and Friday, December 14. The index has lost almost 11 percent of its value since the end of September, vying for the worst quarterly stretch since mid-2011.<\/p>","format":"html","textStyle":"default-body","layout":"body-layout"},{"role":"body","text":"<p>Weakening technicals, along with growth and tariffs fears, remained the big culprits. Barely one-fifth of the S&P 500\u2019s members are above their 50-day moving averages, and fewer than one-third are over their 200-day lines. The index also just had a death-cross (see chart) and closed far from its high almost every session.<\/p>","format":"html","textStyle":"default-body","layout":"body-layout"},{"role":"body","text":"<p>Sentiment remained very gloomy, even though most economic reports <a href="https:\/\/\/2018\/12\/11\/our-curiously-strong-weakening-economy\/">weren\u2019t all that bad<\/a>. Unemployment claims and job openings remained strong, while retail sales only missed by a small margin and industrial numbers were inline.<\/p>","format":"html","textStyle":"default-body","layout":"body-layout"},{"role":"container","components":[{"role":"photo","URL":"bundle:\/\/SPX_20181214-1024x715.jpg","layout":"full-width-image","caption":"S&P 500 showing \u201cdeath cross.\u201d"},{"role":"caption","text":"S&P 500 showing \u201cdeath cross.\u201d","textStyle":{"textAlignment":"center","fontName":"AvenirNext-Italic","fontSize":14,"tracking":0,"lineHeight":14,"textColor":"#4f4f4f"},"layout":{"margin":{"top":0},"ignoreDocumentMargin":false}}],"layout":{"ignoreDocumentMargin":false}},{"role":"body","text":"<p>There also seemed to be minor progress on the trade front as China retreated on intellectual property, soybeans and autos. Investors, burned many times on the <a href="https:\/\/\/2018\/12\/03\/will-a-tariff-ceasefire-lead-to-a-lasting-peace\/">tariff front<\/a>, didn\u2019t seem to believe the good news.<\/p>","format":"html","textStyle":"default-body","layout":"body-layout"},{"role":"body","text":"<p>Speaking of news, there was an unusually large number of negative stories on a range of companies like <a href="https:\/\/\/2018\/12\/14\/boring-pharma-gets-exciting-in-a-bearish-way\/">Johnson & Johnson (JNJ)<\/a>, Costco (COST) and Pfizer (PFE). None of them had much to do with China or trade wars. See our <a href="https:\/\/\/2018\/12\/17\/bad-news-hammered-several-key-stocks-last-week">special report<\/a> for more.<\/p>","format":"html","textStyle":"default-body","layout":"body-layout"},{"role":"body","text":"<p>Financials and energy led the carnage last week, with drops of more than 3 percent. Banks, transports, small caps, home builders and retailers endured similar fates. Only utilities and communications eked out small gains.<\/p>","format":"html","textStyle":"default-body","layout":"body-layout"},{"role":"body","text":"<p>Under Armour (UAA) slid 20 percent last week on poor guidance, accounting for the single biggest drop in the S&P 500. <a href="https:\/\/\/2018\/12\/12\/why-stocks-move-credit\/">Debt-laden<\/a> toy company Mattel (MAT) was the second-lowest in the rankings.<\/p>","format":"html","textStyle":"default-body","layout":"body-layout"},{"role":"body","text":"<p>Broadcom (AVGO) was the best-performer, riding strong results from December 6 up more than 11 percent. <a href="https:\/\/\/2018\/12\/12\/not-all-tech-stocks-are-down-this-quarter\/">Twitter (TWTR)<\/a> was second with a 9 percent gain.<\/p>","format":"html","textStyle":"default-body","layout":"body-layout"},{"role":"body","text":"<p>Investors now face a tough choice. On the one hand, stocks have gotten cheap and the <a href="https:\/\/\/2018\/12\/11\/our-curiously-strong-weakening-economy\/">economy doesn\u2019t seem near recession<\/a>. Interest rates also seem to have <a href="https:\/\/\/2018\/11\/16\/fed-signals-potentially-dovish-turn\/">peaked for now<\/a>.<\/p>","format":"html","textStyle":"default-body","layout":"body-layout"},{"role":"body","text":"<p>On the other hand, why build positions at this moment in late December? Trade worries could linger through a <a href="https:\/\/\/2018\/12\/03\/will-a-tariff-ceasefire-lead-to-a-lasting-peace\/">key deadline in March<\/a>, giving big institutions no reason to buy stocks until more certainty emerges. Earnings season could be rough. Maybe that\u2019s why Lipper reported record mutual-fund outflows last week.<\/p>","format":"html","textStyle":"default-body","layout":"body-layout"},{"role":"body","text":"<p>This week\u2019s calendar is dominated by the <a href="https:\/\/\/2018\/11\/28\/goldilocks-takes-over-the-fed\/">Federal Reserve<\/a>, although there are several other events, starting with the New York Fed\u2019s Empire manufacturing number and NAHB\u2019s home-builder index today.<\/p>","format":"html","textStyle":"default-body","layout":"body-layout"},{"role":"body","text":"<p>Tomorrow brings housing starts and building permits. FedEx (FDX) and Micron Technology (MU) report earnings in the post market.<\/p>","format":"html","textStyle":"default-body","layout":"body-layout"},{"role":"body","text":"<p>Wednesday\u2019s Fed day. Most forecasters expect Jerome Powell to raise interest rates but then scale back the aggressiveness of future hikes. Oil inventories are also due.<\/p>","format":"html","textStyle":"default-body","layout":"body-layout"},{"role":"body","text":"<p>Thursday brings initial jobless claims and Nike (NKE) earnings after the close.<\/p>","format":"html","textStyle":"default-body","layout":"body-layout"},{"role":"body","text":"<p>The week ends with durable-goods orders, revised gross domestic product and personal income and spending on Friday morning. Christmas is the following week.<\/p>","format":"html","textStyle":"default-body","layout":"body-layout-last"}]}],"componentTextStyles":{"dropcapBodyStyle":{"textAlignment":"left","fontName":"AvenirNext-Regular","fontSize":18,"tracking":0,"lineHeight":24,"textColor":"#4f4f4f","linkStyle":{"textColor":"#428bca"},"paragraphSpacingBefore":18,"paragraphSpacingAfter":18,"dropCapStyle":{"numberOfLines":4,"numberOfCharacters":1,"padding":5,"fontName":"AvenirNext-Bold","textColor":"#4f4f4f","numberOfRaisedLines":0}},"default-body":{"textAlignment":"left","fontName":"AvenirNext-Regular","fontSize":18,"tracking":0,"lineHeight":24,"textColor":"#4f4f4f","linkStyle":{"textColor":"#428bca"},"paragraphSpacingBefore":18,"paragraphSpacingAfter":18},"default-title":{"fontName":"AvenirNext-Bold","fontSize":48,"lineHeight":52,"tracking":0,"textColor":"#333333","textAlignment":"left"},"default-byline":{"textAlignment":"left","fontName":"AvenirNext-Medium","fontSize":13,"lineHeight":24,"tracking":0,"textColor":"#7c7c7c"}},"textStyles":{"default-tag-code":{"fontName":"Menlo-Regular","fontSize":16,"tracking":0,"lineHeight":20,"textColor":"#4f4f4f"},"default-tag-pre":{"textAlignment":"left","fontName":"Menlo-Regular","fontSize":16,"tracking":0,"lineHeight":20,"textColor":"#4f4f4f","paragraphSpacingBefore":18,"paragraphSpacingAfter":18},"default-tag-samp":{"fontName":"Menlo-Regular","fontSize":16,"tracking":0,"lineHeight":20,"textColor":"#4f4f4f"}},"componentLayouts":{"body-layout":{"columnStart":0,"columnSpan":7,"margin":{"top":12,"bottom":12}},"body-layout-last":{"columnStart":0,"columnSpan":7,"margin":{"top":12,"bottom":30}},"full-width-image":{"margin":{"bottom":25,"top":25},"columnSpan":7,"columnStart":0},"headerPhotoLayout":{"ignoreDocumentMargin":true,"columnStart":0,"columnSpan":7},"headerBelowTextPhotoLayout":{"ignoreDocumentMargin":true,"columnStart":0,"columnSpan":7,"margin":{"top":30,"bottom":0}},"title-layout":{"margin":{"top":30,"bottom":0}},"byline-layout":{"margin":{"top":10,"bottom":10},"columnStart":0,"columnSpan":7}},"metadata":{"excerpt":"Bears continued to hammer stocks last week, keeping the market on pace for its worst quarter since early this decade. The S&P 500 attempted a feeble bounce before rolling over and closing at its lowest level since April. All told, it declined 1.2 percent between Friday, December 7, and Friday, December 14. The index has lost...","thumbnailURL":"bundle:\/\/mama_bears_cubs_ThinkstockPhotos-866119234.jpg","dateCreated":"2018-12-17T12:33:31+00:00","dateModified":"2018-12-18T17:01:22+00:00","datePublished":"2018-12-17T12:33:31+00:00","canonicalURL":"https:\/\/\/2018\/12\/17\/sellers-keep-market-on-pace-for-terrible-quarter\/","generatorIdentifier":"publish-to-apple-news","generatorName":"Publish to Apple News","generatorVersion":"1.4.3"},"advertisingSettings":{"frequency":1,"layout":{"margin":{"top":15,"bottom":15}}}}

    I should note that this output includes the fix I mentioned in my original post for the ignoreDocumentMargin issue.

    • This reply was modified 1 year, 3 months ago by jcovert.

    Hi. Just checking in to see if anyone has any recommendations for me. Thx!

    Plugin Author Kevin Fodness


    I marked this issue as a bug on GitHub here:

    I’m closing this issue in favor of tracking a fix in a future version on GitHub.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Text may contain HTML tags — caused by ampersand’ is closed to new replies.