<commit_before>import React from 'react';
import 'font-awesome/scss/font-awesome.scss';
import Navigation from '../Navigation/Navigation.jsx';
import './index.scss';

export default class MainLayout extends React.Component {
  getLocalTitle() {
    const currentPath = this.props.location;
    const pathPrefix = this.props.pathPrefix;
    let title = '';
    if (currentPath === (`${pathPrefix}/`)) {
      title = 'Home';
    } else if (currentPath === (`${pathPrefix}/tags/`)) {
      title = 'Tags';
    } else if (currentPath === (`${pathPrefix}/about/`)) {
      title = 'About';
    } else {
      title = 'Article';
    }
    return title;
  }
  render() {
    const { SiteConfig, children } = this.props;
    return (
      <Navigation SiteConfig={SiteConfig} LocalTitle={this.getLocalTitle()}>
        <div>
          {children}
        </div>
      </Navigation>

    );
  }
}

// NOTE: This will be moved under src/layouts/ once Gatsby supports running queries from there.
<commit_msg>Adds missing MainLayout titles for categories and tags.<commit_after>import React from 'react';
import 'font-awesome/scss/font-awesome.scss';
import Navigation from '../Navigation/Navigation.jsx';
import './index.scss';

export default class MainLayout extends React.Component {
  getLocalTitle() {
    function capitalize(string) {
      return string.charAt(0).toUpperCase() + string.slice(1);
    }
    const pathPrefix = this.props.pathPrefix ? this.props.pathPrefix : '/';
    const currentPath = this.props.location.replace(pathPrefix, '');
    let title = '';
    if (currentPath === ('')) {
      title = 'Home';
    } else if (currentPath === ('tags/')) {
      title = 'Tags';
    } else if (currentPath === ('categories/')) {
      title = 'Categories';
    } else if (currentPath === ('about/')) {
      title = 'About';
    } else if (currentPath.includes('posts')) {
      title = 'Article';
    } else if (currentPath.includes('tags/')) {
      const tag = currentPath.replace('tags/', '').replace('/', '');
      title = `Tagged in ${capitalize(tag)}`;
    } else if (currentPath.includes('categories/')) {
      const category = currentPath.replace('categories/', '').replace('/', '');
      title = `${capitalize(category)}`;
    }
    return title;
  }
  render() {
    const { SiteConfig, children } = this.props;
    return (
      <Navigation SiteConfig={SiteConfig} LocalTitle={this.getLocalTitle()}>
        <div>
          {children}
        </div>
      </Navigation>

    );
  }
}

// NOTE: This will be moved under src/layouts/ once Gatsby supports running queries from there.

{'fraction_non_alphanumeric': 0.16295157571099156, 'fraction_numerical': 0.0007686395080707148, 'mean_word_length': 2.9559270516717326, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '5277199', 'n_tokens_mistral': 779, 'n_tokens_neox': 767, 'n_words': 192}