<commit_before>'use strict';

// helper meta tags functions used in Flow Router action functions

var clearMetaTags = function () {
    Meta.setTitle('');
    Meta.unset('og:title');
    Meta.unset('og:description');
    Meta.unset('og:url');
    Meta.unset('og:image');
    Meta.unset('twitter:title');
    Meta.unset('twitter:description');
    Meta.unset('twitter:url');
    Meta.unset('twitter:image');
};

var setMetaTags = function (url, title, desc, image) {
    Meta.setTitle(title);
    Meta.set({
        name: 'name',
        property: 'description',
        content: desc
    });

    Meta.set('og:title', title);
    Meta.set('og:description', desc);
    Meta.set('og:url', url);
    Meta.set('og:image', image);

    Meta.set({
        name: 'name',
        property: 'twitter:card',
        content: 'summary'
    });
    Meta.set({
        name: 'name',
        property: 'twitter:title',
        content: title
    });
    Meta.set({
        name: 'name',
        property: 'twitter:description',
        content: desc
    });
    Meta.set({
        name: 'name',
        property: 'twitter:url',
        content: url
    });
    Meta.set({
        name: 'name',
        property: 'twitter:image',
        content: image
    });
};

// we use here global triggers for Flow Router to clear meta tags using Blaze Meta package
FlowRouter.triggers.enter([clearMetaTags]);

// check out FlowRouter: https://atmospherejs.com/meteorhacks/flow-router

FlowRouter.route('/', {
    name: 'indexView',
    subscriptions: function () { // params
        // example: this.register('indexSubs', Meteor.subscribe('indexDemo'));
    },
    action: function () { // params
        FlowLayout.render('layout', {main: 'indexView'});
    }
});

FlowRouter.route('/subpage', {
    name: 'subpageView',
    subscriptions: function () { // params
        // example: this.register('subpageSubs', Meteor.subscribe('subpageDemo', params.subId));
    },
    action: function () { // params
        var currentUrl = Meteor.absoluteUrl() + FlowRouter.current().path.substring(1);
        var currentTitle = 'Demo subpage title';
        var currentDescription = 'Demo subpage description';
        var currentImage = '';

        // see more in the client/settings/seo.js
        // you can also unset your meta by Meta.unset('og:title');
        // you can unset your all metatags using Flow Router triggers (like we did here using global triggers ...above)

        setMetaTags(currentUrl, currentTitle, currentDescription, currentImage);

        FlowLayout.render('layout', {main: 'subpageView'});
    }
});

FlowRouter.route('/secret', {
    name: 'secretPage',
    subscriptions: function () { // params
        // example: this.register('subpageSubs', Meteor.subscribe('subpageDemo', params.subId));
    },
    action: function () { // params
        var currentUrl = Meteor.absoluteUrl() + FlowRouter.current().path.substring(1);
        var currentTitle = 'Demo secret title';
        var currentDescription = 'Demo secret description';<commit_msg>FR this<commit_after>'use strict';

// helper meta tags functions used in Flow Router action functions

var clearMetaTags = function () {
    Meta.setTitle('');
    Meta.unset('og:title');
    Meta.unset('og:description');
    Meta.unset('og:url');
    Meta.unset('og:image');
    Meta.unset('twitter:title');
    Meta.unset('twitter:description');
    Meta.unset('twitter:url');
    Meta.unset('twitter:image');
};

var setMetaTags = function (url, title, desc, image) {
    Meta.setTitle(title);
    Meta.set({
        name: 'name',
        property: 'description',
        content: desc
    });

    Meta.set('og:title', title);
    Meta.set('og:description', desc);
    Meta.set('og:url', url);
    Meta.set('og:image', image);

    Meta.set({
        name: 'name',
        property: 'twitter:card',
        content: 'summary'
    });
    Meta.set({
        name: 'name',
        property: 'twitter:title',
        content: title
    });
    Meta.set({
        name: 'name',
        property: 'twitter:description',
        content: desc
    });
    Meta.set({
        name: 'name',
        property: 'twitter:url',
        content: url
    });
    Meta.set({
        name: 'name',
        property: 'twitter:image',
        content: image
    });
};

// we use here global triggers for Flow Router to clear meta tags using Blaze Meta package
FlowRouter.triggers.enter([clearMetaTags]);

// check out FlowRouter: https://atmospherejs.com/meteorhacks/flow-router

FlowRouter.route('/', {
    name: 'indexView',
    subscriptions: function () { // params
        // example: this.register('indexSubs', Meteor.subscribe('indexDemo'));
    },
    action: function () { // params
        FlowLayout.render('layout', {main: 'indexView'});
    }
});

FlowRouter.route('/subpage', {
    name: 'subpageView',
    subscriptions: function () { // params
        // example: this.register('subpageSubs', Meteor.subscribe('subpageDemo', params.subId));
    },
    action: function () { // params
        var currentUrl = Meteor.absoluteUrl() + this.path.substring(1);
        var currentTitle = 'Demo subpage title';
        var currentDescription = 'Demo subpage description';
        var currentImage = '';

        // see more in the client/settings/seo.js
        // you can also unset your meta by Meta.unset('og:title');
        // you can unset your all metatags using Flow Router triggers (like we did here using global triggers ...above)

        setMetaTags(currentUrl, currentTitle, currentDescription, currentImage);

        FlowLayout.render('layout', {main: 'subpageView'});
    }
});

FlowRouter.route('/secret', {
    name: 'secretPage',
    subscriptions: function () { // params
        // example: this.register('subpageSubs', Meteor.subscribe('subpageDemo', params.subId));
    },
    action: function () { // params
        var currentUrl = Meteor.absoluteUrl() + this.path.substring(1);
        var currentTitle = 'Demo secret title';
        var currentDescription = 'Demo secret description';
{'fraction_non_alphanumeric': 0.1529567228278824, 'fraction_numerical': 0.0006607201850016518, 'mean_word_length': 2.760869565217391, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5074225', 'n_tokens_mistral': 1784, 'n_tokens_neox': 1743, 'n_words': 424}