Background
All paths, the main path – showing reading recommendations based on the interests a user selected during onboarding – and the fallback path of showing other recommended articles is described in T435522: Recommended reading exp: Show reading recommendations based on user-selected interests.
What (at best) exists at the implementation start of this task:
- A placeholder ReadingRecommendations module from T436326: Recommended reading exp: Create and setup a placeholder component in newcomer home page (Gerrit 1332816): class ReadingRecommendations.
- It provides both mount points: #reading-recommendations-vue-root (desktop, mobile details, overlay) and #reading-recommendations-vue-root--mobile (mobile summary tile).
- The server-rendered "Personalize your daily reads" text inside the mount divs is the no-JS fallback.
- A clear outline to start implementation of the recommendations (preferred at least the most important path – API for user-selected interest topics) T435522
- The Impact module is the precedent for a Vue app inside a homepage module: Impact::getBody() renders an empty mount point <div id="impact-vue-root"> (mobile summary: #impact-vue-root--mobile) plus a no-JS fallback message. modules/ext.growthExperiments.Homepage.Impact/init.js then mounts the app with Vue.createMwApp(), reads the render mode from mw.config.get( 'homepagemodules' ).impact.renderMode (desktop, mobile-summary, mobile-overlay, mobile-details), and takes the data either from server-exported mw.config values or from a REST endpoint via the useMWRestApi composable.
- Reusable pieces outside and already in the repo: CdxCard, to consider also modules/vue-components/ (CText, CList, CListItem, …). modules/vue-components/InterestSelector.vue already renders related articles as <cdx-card :force-thumbnail="true" :thumbnail="…">.
- Per T435522: Recommended reading exp: Show reading recommendations based on user-selected interests a recommendation card must show: article image, article title, Wikidata description, and the interest label. There must be an empty state for articles without an image.
- Nice to have: Thumbnails are bigger than in existing modules, per design.
Goal
Create the Vue component(s) that render the recommendation results inside the RecommendedArticles module, together with the wiring and the mount points, so that up to 4 recommendation cards are displayed on desktop and mobile Special:Homepage.
Scope is presentation only. The component takes the recommendations as props / injected data and renders them. Where the data actually comes from (interest matching, general-recommendation fallback, daily rotation) is T435522: Recommended reading exp: Show reading recommendations based on user-selected interests and its siblings. For this task, mock/fixture data is enough.
Open questions
- ✔️ Own ResourceLoader module (ext.growthExperiments.Homepage.RecommendedArticles) with its own init.js, following the Impact pattern? And where do the files live — modules/ext.growthExperiments.Homepage.RecommendedArticles/? Already answered in own RL module ext.growthExperiments.Homepage.ReadingRecommendations in modules/ext.growthExperiments.Homepage.ReadingRecommendations/ => RL module ext.growthExperiments.Homepage.ReadingRecommendations in 'modules/ext.growthExperiments.Homepage.ReadingRecommendations/'
- ✔️ Data delivery: server-exported. The module exports the day's recommendations through getJsData() into mw.config.get( 'homepagemodules' )[ 'reading-recommendations' ], and init.js reads them the way Impact's getServerExportedData() does.
- The recommendations are computed and cached server side once per wiki-local day (T435522: Recommended reading exp: Show reading recommendations based on user-selected interests and its service task), so there is nothing to fetch that the page does not already have.
- ✔️ Does the module need server-rendered base markup and a no-JS fallback message, as Impact has, or is an empty mount point acceptable? => We chose this for availability with CirrusSearch and also for performance reasons.
- ✔️
Loading state: Skeleton – to be released Skeleton component or vue-components/Skeleton.less https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/GrowthExperiments/+/master/modules/vue-components/Skeleton.less or even Codex PHP CdxCard?=> The loading state is unreachable. Rows arrive with the page, so init.js never provides null, therefore we're not featuring a Skeleton loading for the chosen implementation path. - ✔️ Empty state for a missing image, current CdxCard handling ok – Just relying on empty fallback CSS without early thumbnail rendering otherwise there's a flash with CdxCard loading, will be follow-up patch to main patch
- ✔️ The link to the interest picker (parent requirement 4) => Filed in separate T435525: Recommended reading exp: Show interaction element(s) to select interests on the reading module
Acceptance criteria for done
- Vue component renders a list of up to 4 recommendation cards from provided data.
- Each card shows thumbnail, title, Wikidata description and interest label. Missing image and missing description are handled gracefully, not broken layout.
- Empty and error states are implemented.
- Renders correctly on desktop and mobile,
- in LTR and RTL
- in dark mode
- All user-facing strings internationalizable; messages documented in 'qqq.json'.
- Jest unit test next to the component (repo convention: 'Component.test.js').