Discovering Publications
Learn how to discover new content on Lens.
Feeds
Feeds are personalized lists of content, tailored for each user according to their social graph.
You must be authenticated with a Profile to fetch any feeds. See Profile Login for more information.
Standard Feed
The standard feed, generated from a profile's social graph, can display posts, comments, quotes, mirrors, reactions, and other activities from profiles that the user follows. The feed is organized based on relevance and recency.
- React SDK
- JavaScript SDK
- API
You can use the useFeed hook to get a profile's feed.
Available in @lens-protocol/react-web and @lens-protocol/react-native
import { useFeed, profileId } from '@lens-protocol/react';
function Feed() { const { data, loading, error } = useFeed({ where: { for: profileId('0x28a2') }, });
if (loading) return <div>Loading...</div>;
if (error) return <div>Error: {error.message}</div>;
return ( <ul> {data.map((item, idx) => ( <li key={`${item.root.id}-${idx}`}> // render item details </li> ))} </ul> );}
The hook returns PaginatedReadResult<FeedItem[]>. For more information on pagination, refer to this guide.
Feed Highlights
Feed Highlights is a curated selection of posts and quotes from a profile's feed that have received the most engagement. This feature is useful for quickly catching up on the most popular content.
- React SDK
- JavaScript SDK
- API
You can use the useFeedHighlights hook to get a profile's feed highlights.
Available in @lens-protocol/react-web and @lens-protocol/react-native
import { useFeedHighlights, profileId } from '@lens-protocol/react-web';
function FeedHighlights() { const { data, loading, error } = useFeedHighlights({ where: { for: profileId('0x28a2') }, });
if (loading) return <div>Loading...</div>;
if (error) return <div>Error: {error.message}</div>;
return ( <ul> {data.map((item) => ( <li key={item.id}> // render item details </li> ))} </ul> );}
The hook returns PaginatedReadResult<Array<Post | Quote>>. For more information on pagination, refer to this guide.
Search
Whenever you want to find specific content, you can use the Search feature using a query string and filters.
- React SDK
- JavaScript SDK
- API
You can use the useSearchPublications hook to search through Lens Publications.
Available in @lens-protocol/react-web and @lens-protocol/react-native
import { useSearchPublications, LimitType, SearchPublicationType, appId} from '@lens-protocol/react-web';
export default function SearchPublications() { const { data, error, loading } = useSearchPublications({ query: 'Hello World', limit: LimitType.Ten, where: { publicationTypes: [SearchPublicationType.Post], metadata: { publishedOn: [appId('Orb')], } } });
if (loading) return <p>Loading...</p>;
if (error) return <p>Error: {error.message}</p>;
if (data.length === 0) return <p>No publications found</p>;
return ( <ul> {data.map((publication) => ( hasContent(publication.metadata) && ( <li key={publication.id} style={{marginBottom: '30px'}}> <p>{ publication.metadata.content }</p> </li> ) ))} </ul> );}
function hasContent(metadata: any): metadata is { content: string } { return 'content' in metadata;}
The hook yields a PaginatedReadResult<PrimaryPublication[]>. For more information on pagination, refer to this guide.
Explore
Whenever you want to discover new content, even from profiles outside of the authenticated profile's social graph, you can use the Explore feature.
- React SDK
- JavaScript SDK
- API
You can use the useExplorePublications hook to explore Lens Publications.
Available in @lens-protocol/react-web and @lens-protocol/react-native
import { useExplorePublications, ExplorePublicationsOrderByType} from '@lens-protocol/react-web';
export function ExplorePublications() { const { data, error, loading } = useExplorePublications({ orderBy: ExplorePublicationsOrderByType.LensCurated, });
if (loading) return <p>Loading...</p>;
if (error) return <p>Error: {error.message}</p>;
if (data.length === 0) return <p>No publications found</p>;
return ( <ul> {data.map((publication) => ( <li key={publication.id}>{publication.metadata.content}</li> ))} </ul> );}
The hook yields a PaginatedReadResult<ExplorePublication[]>. For more information on pagination, refer to this guide.