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.
- Click Filter field. , and enter media in the
- Under the Media section, find Media Entity
Twitter and click Enable to enable the
Media entity twitter
module.
Create an entity called Twitter to store the tweets
- Navigate to .
- Click +Add media type.
- In the Name field, enter Twitter.
- From the Media source list, select Twitter.
- Under the Media source configuration section, ensure that
Whether to use Twitter api to fetch tweets or not
value is set to No. - Under the Field Mapping section, ensure that the
Tweet ID
andTwitter user information
sections are set to - Skip field -. - Click Save.
- Select Manage Display from the list next to Edit
for the new
Twitter
media type. - From the Format list of
Tweet URL
, select Twitter embed. - Ensure that the Authored on, Authored by, and Thumbnail fields are in the Disabled section.
- Click Save.
Add media items
- Click .
- 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 .
- Click +Add view.
- In the View name field, enter a name for your view, for example Tweet view.
- Under View Settings, select the options as follows:
show
: Mediaof type
: Twittersorted by
: Unsorted
- In the Block Settings section, select the Create a block checkbox.
- Ensure that the Display format is selected as Slick 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 .
- Find the
welcome
label and click Edit. - In the Variants section, click Panels, then Content.
- Click Add new block.
- Under the Lists(Views) section, select your new block.
- Clear the Display title checkbox and click Add block.
- You can now rearrange the position of your tweet view 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.