<commit_before>const debug = require('ghost-ignition').debug('services:routing:static-pages-router');
const ParentRouter = require('./ParentRouter');
const controllers = require('./controllers');
const common = require('../../lib/common');

class StaticPagesRouter extends ParentRouter {
    constructor() {
        super('StaticPagesRouter');

        this.permalinks = {
            value: '/:slug/'
        };

        this.filter = 'page:true';

        this.permalinks.getValue = () => {
            return this.permalinks.value;
        };

        debug(this.permalinks);

        this._registerRoutes();
    }

    _registerRoutes() {
        this.router().use(this._prepareContext.bind(this));

        // REGISTER: permalink for static pages
        this.mountRoute(this.permalinks.getValue(), controllers.entry);

        common.events.emit('router.created', this);
    }<commit_msg>Dynamic Routing Beta: StaticPageRouter pre-checks for redirects<commit_after>const debug = require('ghost-ignition').debug('services:routing:static-pages-router');
const ParentRouter = require('./ParentRouter');
const controllers = require('./controllers');
const common = require('../../lib/common');

class StaticPagesRouter extends ParentRouter {
    constructor() {
        super('StaticPagesRouter');

        this.permalinks = {
            value: '/:slug/'
        };

        this.filter = 'page:true';

        this.permalinks.getValue = () => {
            return this.permalinks.value;
        };

        debug(this.permalinks);

        this._registerRoutes();
    }

    _registerRoutes() {
        this.router().use(this._prepareContext.bind(this));

        this.router().param('slug', this._respectDominantRouter.bind(this));

        // REGISTER: permalink for static pages
        this.mountRoute(this.permalinks.getValue(), controllers.entry);

        common.events.emit('router.created', this);
    }
{'fraction_non_alphanumeric': 0.14718162839248433, 'fraction_numerical': 0.0, 'mean_word_length': 2.8111332007952288, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '364897', 'n_tokens_mistral': 534, 'n_tokens_neox': 511, 'n_words': 86}