Skip to content

Commit 32906bc

Browse files
committed
Add doc/type pages to the search index
Closes freeCodeCamp#55.
1 parent 68b2911 commit 32906bc

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

‎assets/javascripts/app/app.coffee‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@
7171
return
7272

7373
start: ->
74-
@entries.add doc.entries.all() for doc in @docs.all()
74+
for doc in @docs.all()
75+
@entries.add doc.toEntry()
76+
@entries.add type.toEntry() for type in doc.types.all()
77+
@entries.add doc.entries.all()
7578
@trigger 'ready'
7679
@router.start()
7780
@hideLoading()

‎assets/javascripts/models/type.coffee‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,9 @@ class app.models.Type extends app.Model
66

77
entries: ->
88
@doc.entries.findAllBy 'type', @name
9+
10+
toEntry: ->
11+
new app.models.Entry
12+
doc: @doc
13+
name: "#{@doc.name} / #{@name}"
14+
path: '..' + @fullPath()

‎assets/javascripts/templates/pages/news_tmpl.coffee‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ newsItem = (date, news) ->
2424
result
2525

2626
app.news = [
27-
[ 1390694400000, # January 26, 2013
27+
[ 1392163200000, # February 12, 2013
28+
""" The root/category pages are now included in the search index (e.g. <a href="/#q=CSS">CSS</a>) """,
29+
], [
30+
1390694400000, # January 26, 2013
2831
""" Updated <a href="/angular/">Angular.js</a> documentation """,
2932
], [
3033
1390089600000, # January 19, 2013

0 commit comments

Comments
 (0)