Topics Architecture
Category-driven reference discovery, scoped search, and interactive document viewing.
View and data source
Topics is a filterable reference browser with compact lists or cards and a
context-preserving document viewer. Jekyll indexes the categories and content
of eligible published posts and pages; data/topics_primary.yml selects the
featured filters, and the browser searches the generated JSON catalog.
Topics: reference discovery
Topics organizes published learning material by subject rather than by teaching time. It provides category selection, filtered browsing, full-text search and context-preserving document navigation.
Blogs supplies the document publishing and interactive viewing foundation. Courses organizes documents into curriculum, sprints and weeks. Topics supplies another entry into the same authored material, independent of schedules, announcements and course chat.
A document can participate in both a course and a reference collection. Its categories determine its Topics membership; its course/week metadata determines its curriculum placement. Neither viewing context takes ownership of the authored content.
System picture
Authoritative Markdown / IPYNB / DOCX sources
|
v
Conversion and Jekyll posts/pages
|
+---- categories ----> Topics
| ├── Reference browser
| │ ├── Topic Filter - prominent categories
| │ ├── More Categories - remaining categories
| │ ├── Cards / List browsing
| │ └── Scoped full-text Search
| │ ├── Title matches - highlighted cards
| │ └── Text matches - file name, excerpt and category cards
| └── Topics document view
| ├── Full authored content
| ├── Runners and Submissions
| └── Return and related-document navigation
|
+---- course/week ---> Courses
└── Curriculum and course document view
Blogs supplies shared document layouts and interactive integrations.
The diagram describes capabilities and relationships, not separate copies of authored lessons. Topics and Courses now use one canonical document URL with navigation context in the query string, rather than generated document copies.
Categories and primary topics
The content model uses existing frontmatter:
categories: [Java, Algorithms]
Categories are independent facets, not an ordered parent/child path. Both filter groups support multiple selections, and the OR/AND buttons apply across both groups. OR, the default, finds documents matching any checked category, with each document appearing once. AND requires every checked category. For example, Java OR Algorithms includes documents in either collection, while Java AND Algorithms includes only documents in both.
The primary topics configuration orders prominent categories: SASS, Python, Java, JavaScript, Flask, Spring, Systems, CS111, CS112 and CS113. This YAML controls visibility and order, not membership. Primary categories remain selectable even when their collection is empty. Remaining discovered categories appear in the secondary group.
No separate topics: attribute is required. Membership is not inferred from
filenames, week numbers, lesson language or lesson grouping. CS112 and CS113
reference their existing outline documents through explicit categories; links
from an outline do not automatically assign those categories to linked lessons.
Build-time discovery
The Topics generator discovers categorized Jekyll posts and pages. It omits hidden documents, drafts, search-excluded content and generated course player pages. Documents are deduplicated by original URL and sorted by title for ordinary browsing.
The generator creates:
- A catalog with title, description, category keys and display labels, source
path (and the original
.docxname of a converted Word document), original URL, Topics view URL, searchable content and optional course/week display metadata. - Primary and secondary category collections for the browser.
- A JSON search catalog at
/assets/js/projects/topics/data.json. - Compatibility redirects under
/topics/view/, without lesson bodies.
Category keys are lowercase for comparison; display labels retain authored names. Invalid category values or an invalid primary-topic configuration fail the build rather than silently changing discovery.
Search text is derived from source content with script/style blocks, Liquid tokens and HTML tags removed. It is not a crawl of rendered pages; content loaded through relative includes is not expanded into the search text.
Browser and search
The browser include is a full-width page
with a sidebar (ocs__split--aside): Search and the two visible checkbox
groups, Topic Filter and More Categories. More Categories shows categories with
at least five documents, ordered by count with alphabetical ties. An already
selected category below the threshold remains visible for clearing; search
indexes category names as well as document text. The landing shows topic
sections with unit cards and scrollable lesson lists; each lesson is a dropdown with its full
description and an Open lesson link, and quizzes and FRQ practice sit in the
unit’s Practice row. Units come from lesson titles; their optional names come
from topics_units.yml. Layout details are in the
README.
Topic Filters holds the two disclosures, both open by default. Topic Filter starts with OR, AND and CLEAR:
ocs__btn buttons in an ocs__links group, the current choice filled and
aria-pressed, disabled until the search index loads. CLEAR clears only category
selections. Search has an in-field clear control.
Each clear button is dimmed and disabled when its corresponding state is empty.
The browser controller builds a Lunr index in the client from the static catalog. Title, description, content and category names participate in search, with title matches boosted. User input is tokenized as terms rather than interpreted as Lunr query syntax.
Browsing and search use the same category filter:
| Mode | Output |
|---|---|
| No query | Topic sections with unit cards (lesson dropdowns or cards) |
| Search query | Title-match cards, followed by text-match cards with excerpts |
| No matching documents | Explicit empty-result status |
| Index unavailable | Error status with ordinary document links still available |
Each search result appears in only one group. Title hits take precedence; otherwise content or description supplies the excerpt. Each group preserves search relevance ordering and displays its count beside its heading. Search uses title cards regardless of the browsing view selection.
The model helpers implement the category filter, URL state,
match grouping and excerpt construction. Highlights are created with text nodes
and mark elements, not injected document HTML. Search results remain within
the selected collection rather than replacing it with a global search overlay.
Document viewing and navigation
The reference browser opens the original permalink with
?context=topics&topics_view=1. Topics opts discovered documents into the
shared page viewer, including bespoke layouts; a page can also opt into a
different viewer such as Capstone. Only the first matching viewer activates.
The Topics adapter hides the reader toolbar and sidebar when present, moves the
existing Microblog action into the shared toolbar, and leaves content in place.
On selection the browser saves the displayed, deduplicated order, expanded
lessons, and page and unit-list scroll positions in session storage. Previous/next use this snapshot, including practice
and full-text results. The return link restores URL filters and session scroll;
without a matching snapshot the viewer reports that stepping is unavailable.
The shared reader renders one document with a
Course or Topics sidebar. Its controller
switches navigation without replacing content, runner editors or submission
forms. Course options come only from the document’s own course placements.
The Blogs post layout retains the original document URL as submission identity and uses its existing forms and feedback checks in both contexts. Chat is not disabled by making a reference copy: there is no copy. Bespoke application layouts remain intact rather than being forced into the document shell.
Former /topics/view/ addresses contain small compatibility redirects. They
preserve filters and fragments while forwarding to the canonical document.
The ordinary reader’s Topics return link restores the category/query state. Its sidebar
uses the same category selection rules as the full browser; full-text search
and highlighting remain in the full Topics catalog.
URL parameters carry browser state:
- Repeated
categoryvalues identify selected facets. qcarries the search text.match=andrequires every checked Topic Filter box; OR is the default.view=cardsshows cards inside unit cards; the compact lesson list is the default.
State is shareable and restored during browser history navigation. Clearing filters preserves the query, view and OR/AND choice; clearing Search preserves filters and view.
Integration boundaries
| System or resource | Responsibility |
|---|---|
| Topics | Category discovery, filtered collections, scoped search and reference navigation |
| Blogs | Publishing layouts, full-document presentation and interactive integrations |
| Courses | Curriculum selection, schedules, progression and course navigation |
| Authoring and conversion | Maintain source content and convert notebooks/DOCX into publishable documents |
| Runners, Submissions and Grading | Execute exercises, persist evidence and evaluate submissions |
| Site shell and authentication | Global navigation, preferences, identity and API configuration |
The browser is reusable outside its landing page. Language-reference pages can
start with a category selected. A course can include the browser with
course_context=true; that adapter displays week metadata and links to
original course documents. Weeks remain display context, not topic membership.
Topics does not own Calendar or Chat views. Its reference-discovery interface does not require an account; interactive document capabilities retain their own authentication and backend requirements.
Sources and publication
| Source | Responsibility |
|---|---|
| Pages | /topics/ landing and /search/ compatibility redirect |
| Includes | Browser and document navigation |
| Generator | Catalog, category collections and generated views |
| Primary-topic YAML | Prominent category labels and order |
| JavaScript | Browser state, search and document link context |
| SCSS | Topics layout and component styling |
| Tests | Discovery, rendering, filtering, search and identity contracts |
| Distribution manifest | Stable Jekyll and browser publication destinations |
Topics is registered as systems/topics:dev in the
project registry. The shared project Makefile publishes
resources through its manifest; documentation uses the shared docs target.
The root Makefile coordinates publication, conversion
and Jekyll build/serve. Runtime copies and converted posts are generated outputs,
not authoring locations.
Lunr is a shared vendor asset. Inputs and buttons use shared OCS styling; local SCSS handles disclosure layout and result presentation. The normal project build does not require a separate npm installation.
Validation
bundle exec ruby scripts/test_topics.rb: catalog and primary configuration, original versus Topics rendering, source-relative includes, submission identity and browser markup.node --test tests/topics.test.mjs: category filters, scoped search, URL state, grouped matches and highlighted excerpts.- Jekyll builds through the repository workflow: generated routes, Liquid rendering and Ruby Sass compatibility.
- Browser checks: disclosure defaults, independent clearing, URL restoration, result counts, document navigation and mobile layout.