Przeglądaj źródła

Add doc/type pages to the search index

Closes #55.
Thibaut 11 lat temu
rodzic
commit
32906bccc6

+ 4 - 1
assets/javascripts/app/app.coffee

@@ -71,7 +71,10 @@
     return
 
   start: ->
-    @entries.add doc.entries.all() for doc in @docs.all()
+    for doc in @docs.all()
+      @entries.add doc.toEntry()
+      @entries.add type.toEntry() for type in doc.types.all()
+      @entries.add doc.entries.all()
     @trigger 'ready'
     @router.start()
     @hideLoading()

+ 6 - 0
assets/javascripts/models/type.coffee

@@ -6,3 +6,9 @@ class app.models.Type extends app.Model
 
   entries: ->
     @doc.entries.findAllBy 'type', @name
+
+  toEntry: ->
+    new app.models.Entry
+      doc: @doc
+      name: "#{@doc.name} / #{@name}"
+      path: '..' + @fullPath()

+ 4 - 1
assets/javascripts/templates/pages/news_tmpl.coffee

@@ -24,7 +24,10 @@ newsItem = (date, news) ->
   result
 
 app.news = [
-  [ 1390694400000, # January 26, 2013
+  [ 1392163200000, # February 12, 2013
+    """ The root/category pages are now included in the search index (e.g. <a href="/#q=CSS">CSS</a>) """,
+  ], [
+    1390694400000, # January 26, 2013
     """ Updated <a href="/angular/">Angular.js</a> documentation """,
   ], [
     1390089600000, # January 19, 2013