Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jnovinger/5833414 to your computer and use it in GitHub Desktop.
Save jnovinger/5833414 to your computer and use it in GitHub Desktop.

Justification

Readers should be able to easily find the most recent content on our site. Readers should be able to do this on the main page, via a 'Latest' well that shows the 7 most recent stories. Readers should additionally be able to peruse all stories in reverse chronological order (much like the old site) on a separate 'Latest' page.

Requirements

  • Create a 'latest' queryset in apps/articles/querysets.py
  • Add a 'Latest' well entry in the admin (development, staging, and production)
  • Add the 'Latest' well to the 'Homepage' Page Ordering, ranking it right below the 'Trending' well
  • Add 'latest' as a type of query to SECTIONS
  • Add URLconf for 'latest' page

Acceptance

Criteria

This issue will be considered closed when:

  • The 'Latest' well appears on the homepage and includes the 7 most recent stories.
  • The 'Latest' page appears at /latest/ and includes all articles in reverse chronological order.
  • Infinite scroll works on the 'Latest' page at /latest/

Evidence

A screenshot of the following things are required upon completion. Submit your supporting evidence as file attachments to the parent JIRA issue.

  • The 'Latest' well on the homepage
  • The initial 'Latest' page without infinite scroll engaged
  • A scrolled down view of the 'Latest' page showing infinite scroll working

Architecture

This feature will include work done in the main dailydot.com repository consisting of work in Python/Django, HTML, and potentially JS templating.

To implement the 'Latest' well and page, we'll add additional logic to the get_page() function in apps/site/views.py to inject the 'latest' well data into the context. The query will be defined as 'latest' in apps/articles/querysets.py and be used in get_page(). From there, we'll modify the inifiniti-loop.html template to include an additional well right below the 'Trending' well using the wells/article_block_pull_right.html template.

To implement the 'Latest' page we will add an additional 'type' to the SECTIONS dictionary in apps/site/views.py that will perform queries and title setting for SectionView and SectionInfiniteScrollView. The qs member of the SECTION['latest'] entry shall make sure that articles are sorted in reverse chronological order. In addition, URLconf entries will be made to connect /latest/ to SectionView and /latest/infinite_scroll/?index=<n> to SectionInfiniteScrollView.

Tests

  • Test that the latest queryset returns the correct articles (data to be supplied by dd_articles.json)
  • Test that SectionView handles the 'latest' type and returns the appropriate context
  • Test that SectionInfiniteScrollView handles the 'latest' type and returns the appropriate context

Production Impact

Since the purpose of this feature is to restore a viewing mode request by readers, it's reasonable to believe that incurred page views for /latest/ will be 'syphoned' from the current home page. However, the current home page will incur an additiona DB query to retrieve the list of the latest stories. This will be mitigated by the caching nature of the Edgecast ADN and can be further mitigated through the use of server side caching of the results of the 'latest' query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment