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

How to point a tab to a subdomain and in a new tab? #855

Closed
4 tasks done
Aptura opened this issue Jan 14, 2023 · 5 comments
Closed
4 tasks done

How to point a tab to a subdomain and in a new tab? #855

Aptura opened this issue Jan 14, 2023 · 5 comments

Comments

@Aptura
Copy link

Aptura commented Jan 14, 2023

Checklist

  • I have read the newlest tutorials and know the correct effect of the functional design.
  • There is no similar question on existing issues (including closed ones).
  • I have tried to find the answer on Jekyll Forum and StackOverflow.
  • My question is based on the latest code of the master branch.

Description

Hello, I've come to bother you again, hoping to have done enough research beforehand.

I have added a page named DRAW under HOME, I would like to make it point to a subdomain and in a new tab but after trying several different things I can't manage to do it.

image

I tried different tags in my _tabs/draw.md but nothing worked, I think I'm not looking at the problem from the right angle and I'm missing some information.

Is it easier to integrate the desired html rather than redirecting to a subdomain?
Should I link the DRAW directly with a page in html instead of md?

Thanks in advance!

@NichtsHsu
Copy link
Contributor

NichtsHsu commented Jan 14, 2023

Following codes make your tabs point to another page under the same domain.

{% for tab in site.tabs %}
<li class="nav-item{% if tab.url == page.url %}{{ " active" }}{% endif %}">
<a href="{{ tab.url | relative_url }}" class="nav-link">
<i class="fa-fw {{ tab.icon }} ml-xl-3 mr-xl-3 unloaded"></i>
{% capture tab_name %}{{ tab.url | split: '/' }}{% endcapture %}
<span>{{ site.data.locales[site.lang].tabs.[tab_name] | default: tab.title | upcase }}</span>
</a>
</li> <!-- .nav-item -->
{% endfor %}

Here is my suggestion:

  <!-- Add your new tab here without creating a *.md file -->
  <li class="nav-item">
    <a href="/your/subdomain/url" class="nav-link" target="_blank">
      <i class="fa-fw your-icon ml-xl-3 mr-xl-3 unloaded"></i> 
      <span>your_tab_name</span>
    </a>
  </li>

 <!-- Keep original codes -->
 {% for tab in site.tabs %} 
 <li class="nav-item{% if tab.url == page.url %}{{ " active" }}{% endif %}"> 
   <a href="{{ tab.url | relative_url }}" class="nav-link"> 
     <i class="fa-fw {{ tab.icon }} ml-xl-3 mr-xl-3 unloaded"></i> 
     {% capture tab_name %}{{ tab.url | split: '/' }}{% endcapture %} 
  
     <span>{{ site.data.locales[site.lang].tabs.[tab_name] | default: tab.title | upcase }}</span> 
   </a> 
 </li> <!-- .nav-item --> 
 {% endfor %} 

Also change $tab-count to {{ site.tabs | size | plus: 2 }} here.

$tab-count: {{ site.tabs | size | plus: 1 }}; // plus 1 for home tab

@Aptura
Copy link
Author

Aptura commented Jan 14, 2023

Thanks for your answer @NichtsHsu , I understand the idea, however I use the starter and I don't have a _includes/sidebar.html folder.
So should I include the files in the root of my repository?

@NichtsHsu
Copy link
Contributor

So should I include the files in the root of my repository?

Yes, according to the jekyll doc overriding theme defaults, you can cover theme's files by creating your own under the same directory.

@Aptura
Copy link
Author

Aptura commented Jan 15, 2023

It's great, thank you @NichtsHsu !
Sorry I'm in the middle of discovering and learning all this!

@Aptura Aptura closed this as completed Jan 15, 2023
@ser-mk
Copy link

ser-mk commented Jan 24, 2023

I would suggest the easy way with redirect

ser-mk/ser-mk.github.io@a14a03c

just define redirect layout and then set redirect link

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

3 participants