Skip to content

Tools for managing our site header and footer on sites not powered by polopoly

Notifications You must be signed in to change notification settings

nydailynews/vendor-nav

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vendor Nav

Tools for managing off-of-main-site header / footer implementations. This includes scripts for scraping the main site and parsing out the header and the footer with regular expressions. It also includes tools for taking the header and footer markup and adding that markup to a javascript file that can be included on other sites to replicate the main site's header and footer.

Vendor nav javascript used on the majority of vendor sites exists at https://extras.denverpost.com/vendor_templates/mason/vendor-include.js and is updated every 30 minutes.

Example implementation

Denver Post

<html>
<head>
...
</head>
<body>
<div id="dfmHeader"><!--Header Goes Here--></div>

...

<script src="http://extra.denverpost.com/vendor_templates/mason/vendor-include.js"></script>
        <script> dfmNav.initParams("mode|article", "site|denverpost", "pageTitle|Crime Map and Stats", "leaderboard|false", "thirdParty|true"); </script>
</body>
</html>

Daily News

<html>
<head>
...
    <script>var nav_params = {section: 'News Quizzes', url: 'http://interactive.nydailynews.com/quiz/'};</script>
    <script src="http://interactive.nydailynews.com/library/vendor-nav/vendor-include.js" defer></script>
</head>
<body>
<!-- SITEHEADER-START -->
<header id="templateheader"></header>
<!-- SITEHEADER-END -->

...
 
<!-- FOOTER-START -->
<footer id="templatefooter"></footer>
<!-- FOOTER-END --><script src="path/to/vendor-include.js"></script>
</body>
</html>

Non-Denver Post

<html>
<head>
...
</head>
<body>
<header id="templateheader"><!--Header goes here--></header>

...

<footer id="templatefooter"><!-- Footer will go in here --></footer>
<script src="path/to/vendor-include.js"></script>
</body>
</html>

How it works

Denver Post

This is more or less the cron job that fires every thirty minutes:

*/30 * * * * cd path/to/vendor-nav; source .env-vars.bash; date > log; ./scrape.bash >> log

scrape.bash calls parse.py, which downloads a Denver Post page and pulls out the necessary elements, then ftp's the pieces and the javascript that makes the pieces work to extras.

Non-Denver Post

Same as above, except your cronjob will look something like

*/30 * * * * cd path/to/vendor-nav; source .env-vars.bash; date > log; ./scrape.bash --url http://www.nydailynews.com/ --slug dailynews >> log

Or, if you're using an article page

*/30 * * * * cd path/to/vendor-nav; source .env-vars.bash; date > log; ./scrape.bash --url http://www.nydailynews.com/opinion/bachelor-stars-ben-higgins-lauren-bushnell-split-article-1.3168031 --slug dailynews >> log

Also, scrape.bash will execute a not-in-repo file named deploy.bash, which is where you can put all your environment-specific calls.

About

Tools for managing our site header and footer on sites not powered by polopoly

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 94.8%
  • JavaScript 2.9%
  • Python 1.8%
  • Shell 0.5%