Tutorial: Displaying tweets on the front page
You can customize the appearance of the front page of your Developer Portal to display recent tweets. You might use the tweets to provide your users with information, such as service availability or marketing campaigns.
Before you begin
You must have a Developer Portal enabled, and you must have administrator access to complete this tutorial. The tutorial Creating the Portal explains how to enable the portal if you have not already done so.About this tutorial
In this task, you create a view, customize that view to show tweets, then embed that view on the front page of your Developer Portal site.
Before you begin, the front page looks like this:
This tutorial takes you through the following steps:
Enable the Media entity twitter
module
- Log in to your Developer Portal as an administrator.
- If the administrator dashboard isn’t displayed, click Manage to display it.
- Click Extend, enter media in the search bar.
- Check Media Entity Twitter, under MEDIA.
- Click Enable.
Create an entity called Twitter to store the tweets
- Navigate to .
- In the Name field, enter Twitter.
- In the Media source drop-down, select Twitter.
- Ensure that Whether to use Twitter api to fetch tweets or not value is set to No.
- Ensure the values in the FIELD MAPPING section are set to -
Skip field -.
- Click Save.
- Click Manage display from the Edit dropdown for the new Twitter media type.
- Drag the Authored on, Authored by, and
Thumbnail fields to the Disabled section, and set the
FORMAT of the Tweet URL field to Twitter
embed.
- Click Save.
Add media items
- Navigate to .
- In the Name field, enter a name for the media, for example Drupal Tweet.
- In the Tweet URL field, enter a URL, for example,
https://twitter.com/drupal/status/966443708160839684
. - Click Save.
- Repeat these steps to add more tweets, you need at least 2 to make a carousel view.
Create a carousel view
- Navigate to .
- In the View name block, enter a name for your view, for example Tweet view.
- Under VIEW SETTINGS, show Media of type Twitter sorted by Unsorted.
- In the BLOCK SETTINGS, section check Create a
block and ensure it is Display formatSlick
Carousel of fields.
- Click Save and edit.
Customize the carousel view
You are now on the page where you can edit your view.
Embed the view on the front page of your Developer Portal
- Navigate to .
- Click Edit on the welcome page.
- Click Panels, then Content.
- Click Add new block.
- Select your new block, which is under LISTS(VIEWS).
- Deselect Display title then, click Add block.
- You can now rearrange your view to be where you would like it on the front page.
- Click Update and save.
What you did in this tutorial
You can check that the view you created appears on the front page of your site page.
What to do next
You can edit your view at any time by navigating to
and selecting your view by its name. You can also modify or delete the view's layout on the front page by navigating back to the layout section of your page under .You can also integrate your Twitter data dynamically. For more information, see the links below.