From 79e55d9a389dcf818d27d93b2e510aedc87c97a3 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Tue, 24 Sep 2024 15:17:49 -0500 Subject: [PATCH 1/2] Add directions around language handling for custom feeds --- docs/starter-templates/custom-feeds.mdx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/starter-templates/custom-feeds.mdx b/docs/starter-templates/custom-feeds.mdx index 4e92a1512..0e0fd4009 100644 --- a/docs/starter-templates/custom-feeds.mdx +++ b/docs/starter-templates/custom-feeds.mdx @@ -79,6 +79,10 @@ We strongly encourage that the cursor be _unique per feed item_ to prevent unexp We recommend, for instance, a compound cursor with a timestamp + a CID: `1683654690921::bafyreia3tbsfxe3cc75xrxyyn6qc42oupi73fxiox76prlyi5bpx7hr72u` +#### Language handling + +Implemented correctly, requests to `getFeedSkeleton` should populate the `Accept-Language` header with comma-separated BCP-47 language codes e.g. `en,fr`. You should use this to return only posts that match those languages where possible. If language filtering is applied, you should in-turn populate the `Content-Language` header with the languages you used to filter. + #### Suggestions and Examples How a feed generator fulfills the `getFeedSkeleton` request is completely at their discretion. At the simplest end, a Feed Generator could supply a "feed" that only contains some hardcoded posts. @@ -89,4 +93,4 @@ Depending on your algorithm, you likely do not need to keep posts around for lon Some examples: - A community feed: Compile a list of DIDs within that community and filtering the firehose for all posts from users within that list. -- A topical feed: Filter the algorithm for posts and pass the post text through some filtering mechanism (an LLM, a keyword matcher, etc.) that filters for the topic of your choice. \ No newline at end of file +- A topical feed: Filter the algorithm for posts and pass the post text through some filtering mechanism (an LLM, a keyword matcher, etc.) that filters for the topic of your choice. From 468667751b5d557ff53a5dc6605d9a0522f40e6e Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Tue, 1 Oct 2024 16:55:29 -0500 Subject: [PATCH 2/2] Update docs/starter-templates/custom-feeds.mdx Co-authored-by: bnewbold --- docs/starter-templates/custom-feeds.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/starter-templates/custom-feeds.mdx b/docs/starter-templates/custom-feeds.mdx index 0e0fd4009..6bf27cc88 100644 --- a/docs/starter-templates/custom-feeds.mdx +++ b/docs/starter-templates/custom-feeds.mdx @@ -81,7 +81,7 @@ We recommend, for instance, a compound cursor with a timestamp + a CID: #### Language handling -Implemented correctly, requests to `getFeedSkeleton` should populate the `Accept-Language` header with comma-separated BCP-47 language codes e.g. `en,fr`. You should use this to return only posts that match those languages where possible. If language filtering is applied, you should in-turn populate the `Content-Language` header with the languages you used to filter. +When making requests to `getFeedSkeleton`, clients are encouraged to populate the `Accept-Language` HTTP header with comma-separated BCP-47 language codes e.g. `en,pr-BR`. Feed generators can use this language context to filter or rank posts. If language filtering is applied, the feed generator should use the the `Content-Language` response header indicating the parsed language codes. #### Suggestions and Examples