Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It's now time to update your fine guide to a more simpler way #7

Open
diev opened this issue Jan 8, 2017 · 2 comments
Open

It's now time to update your fine guide to a more simpler way #7

diev opened this issue Jan 8, 2017 · 2 comments

Comments

@diev
Copy link

diev commented Jan 8, 2017

GitHub Pages now use https://github.com/blog/2289-publishing-with-github-pages-now-as-easy-as-1-2-3

@jmcglone
Copy link
Owner

jmcglone commented Jan 9, 2017

@diev thank you for pointing this out. I have been meaning to update the guide in other areas and now I suppose these new GH pages features force my hand. I'll get to it!

@diev
Copy link
Author

diev commented Jan 9, 2017

I am currently investigating the dual+ language possibilities of this way, when no Front Matter for .md files present, just by proper file names: a native language page.md and page-en.md for English (and i.e. page-fr.md for French if somewhere). With an exception (but otherwise a nice looking feature as for native language sites) of index.md and en.md for the root entries (i.e. for my case it gives domain.ru and domain.ru/en as result).

I know your way of using **/page/index.html, but the new GH aproach uses a smart feature to automaticaly replace root //site/page.md to //site/page (and //site/page-en for my case) for readers! The only disadvantage I see is to get 404.md instead //site/page/ (of your way). But this makes the site structure very simple for a writer (for his/her 4+ pages as in your guide).

I very like your site for its zen simplicity, but the world has more languages than the English one :)

Below is a working sample of my code in /_layouts/default.html:

<!DOCTYPE html>
{% if page.url == "/" or page.url == "/index.html" or page.url == "/en.html" %}
  {% assign home = true %}
{% endif %}
{% if page.url contains "/en.html" or page.url contains "-en.html" %}
  {% assign en = true %}
  <html lang="en">
{% else %}
  <html lang="ru">
{% endif %}
  <head>
    ...
  <body>
    ...
            {% if en %}
              <span class="credits left">Project by <a href="/en" title="Home Page">Dmitrii Evdokimov</a></span>
            {% else %}
              <span class="credits left">Project by <a href="/" title="Сайт">Дмитрий Евдокимов</a></span>
            {% endif %}
    ...

Another point for your attention is a possibility to create more subsites in one GH account if the first one (per user) is located in the user.github.io repo as yours and others are in different repos in their docs/ magic (in new way) folders:

        {% if site.github.is_user_page %}
          {{ content }}
        {% elsif site.github.is_project_page %}
          <h1>{{ site.title | default: site.github.repository_name }}</h1>
          <p>{{ site.description | default: site.github.project_tagline }}</p>
          {{ content }}
        {% else %}
          ...
        {% endif %}

Good luck to your guide! I recommend it to all my friends :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants