vlucas / devdata.io

The Data You Need, The Programming Language You Want
http://devdata.io
BSD 3-Clause "New" or "Revised" License
74 stars 25 forks source link

The Website Keywords Meta Tag #22

Open hasanbayatme opened 8 years ago

hasanbayatme commented 8 years ago

You can use the available datasets names in keywords, the current meta tag is:

<meta name="keywords" content="dev data, developer data, states list, countries list, list of states, list of countries"></meta>

but you can replace it with better functionally, easily include below code to your app.js:

/**
 * Config
 */
var supportedFormats = {
  'javascript': 'JavaScript',
  'php': 'PHP',
  'python': 'Python',
  'ruby': 'Ruby',
  'csharp': 'C#',
  'lua': 'Lua'
};
var datasets = {
  'states': 'U.S. States',
  'canadian-provinces': 'Canadian Provinces',
  'countries': 'World Countries',
  'currencies': 'World Currencies',
  'timezones': 'World Time Zones',
  'airport-codes': 'International Airport Codes',
  'http-status-codes': 'HTTP Status Codes'
};
var keywords = [ 'dev data', 'developer data' ];
var dashPattern = new RegExp( '-', 'g' );
var datasetNames = Object.keys( datasets );
for ( var i = 0; i < datasetNames; i++ ) {
  var datasetName = datasetNames[ i ];
  datasetName.replace( dashPattern, ' ' ); // Remove dash from dataset name
  keywords.push( datasetName + ' list' );
  keywords.push( 'list of ' + datasetName );
}
keywords = keywords.toString(); // Convert the keywords array to string

/**
 * Express
 */
var app = express();
app.set('view engine', 'jade');
app.engine('jade', require('jade').__express);
app.use(express.static(__dirname + '/public'));

app.get('/', function(req, res) {
  res.render('index', { languages: supportedFormats, datasets: datasets, keywords: keywords });
});

then use it in your layout/main.jade:


doctype html
html(lang="en")
  head
    meta(charset="utf-8")
    meta(http-equiv="X-UA-Compatible", content="IE=edge")
    meta(name="viewport", content="width=device-width, initial-scale=1.0")
    meta(name="keywords", content="#{keywords}")
    ...
vlucas commented 7 years ago

Nice idea. Thanks for this.

hasanbayatme commented 7 years ago

Thanks for accepting, i am very happy to see you are back.

@vlucas How can i join the repository? Can you add me?

vlucas commented 7 years ago

Just added you.

vlucas commented 7 years ago

I am tied up at work at the moment, but I should be able to do a new deploy in a few hours.

hasanbayatme commented 7 years ago

Thanks for adding me. Should i have website access to make the website changes?

vlucas commented 7 years ago

I don't have an easy way of giving you access to deploy at the moment (like hooking this up to git), but let me know when it's ready, and I can deploy it manually.