كنت أقرأ هذه المقالة في المدونة
Consider the typical sections of a daily newspaper: Arts, Sports, Business, Travel, Local, and World. Any given article belongs to just one of those sections, and the content in each section is quite different, such that some people, for example, may...
ولاحظت إشارة إلى “استعلامات الوسوم” في صفحة رئيسية مخصصة:
أعلم أنه يمكنني البحث عن طريق الوسم باستخدام الصيغة tags:XXX في شريط البحث. كما أعلم أنه يمكنني إعادة إنشاء البحث عبر عنوان URL الناتج. لكن ما لا أفهمه هو كيفية استرجاع قائمة بالمشاركات المطابقة للبحث فقط في صفحة رئيسية أو صفحة ثابتة، دون كل العناصر الأخرى الموجودة في استجابة البحث.
هل يجب أن أستخدم واجهة برمجة التطبيقات (API) وأبني تطبيق ويب للحصول على استعلام مخصص مثل هذا، أم توجد حيلة أخرى؟
The custom homepage you’re referencing pulls in the topics from a tag using AJAX and an endpoint like this:
https://meta.discourse.org/tags/theme.json
If you want to get the contents of a search (can you clarify what you mean by “all the other stuff”?):
https://meta.discourse.org/search.json?q=reverse%20engineer&expanded=true
For more details about finding the data that populates a specific page, you can look here:
Discourse is backed by a complete JSON api. Anything you can do on the site you can also do using the JSON api.
Many of the endpoints are properly documented in the discourse_api gem, however some endpoints lack documentation.
To determine how to do something with the JSON API here are some steps you can follow.
Example: recategorize a topic.
Go to a topic and start editing a category:
[image]
Open Chrome dev tools, switch to the Network tab, select XHR filter:
[image]
Perform the op…