4

I want to remove all the HTML code from the feed created using the Views module, since LinkedIn doesn't seem to like it that way it comes. I have seen the module clean links, but I'm running Drupal 7 and even with the patch I found I can't get it to work. Is there any file I can edit and add "strip_tags" to get it to work?

Note, that Im the biggest newbie on Drupal, but I know my way around PHP.

1

Easy way to do this in D7 is through the Display Format settings. Under the content type(s) of the nodes in your view, you want to add a custom display for RSS and then set the fields you want to alter to plain text.

  • Go to Structure -> Content Types, and select 'Manage Display' next to your content type.
  • On the bottom of the list of fields, expand 'Custom Display Settings' and check the box for RSS and save
  • Now, in the upper right-hand corner you should see that you have display format settings for Default, Teaser, and RSS - select RSS.
  • In the format settings for each of the fields, you want to select 'Plain Text' or whatever equivalent you like.
  • this method would be more ideal than making a custom template. I voted for it. – Arosboro Apr 2 '12 at 14:42
  • 3
    Hai, This doesn't seem to be working. It still ads some html tags into the xml feed. Example: <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-inline clearfix&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Body:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt; and so on :/ What am I doing wrong >_< – Sandra Wallin Apr 3 '12 at 7:51
1

Check the advanced section of views and look for theme information. It will tell you which template you can make to override output. You can place your strip_tags code there.

You probably want to edit something like views-view-rss--test--feed.tpl.php in your theme's templates directory.

1

The trick is to use 'fields' option and NOT 'content' option in FORMAT. This way you have more control over how and what is displayed.

So if you want your body field to populate the description tag you will be able to format it as plain text

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.