LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-04-2019, 04:19 PM   #1
motherboard
LQ Newbie
 
Registered: Jun 2018
Posts: 6

Rep: Reputation: Disabled
html link shortcut


Code:
<a href="http://www.website.com/very/long/path/page1.htm">Page 1</a>
<a href="http://www.website.com/very/long/path/page2.htm">Page 2</a>
<a href="http://www.website.com/very/long/path/page3.htm">Page 3</a>
The above requires me to keep inserting
"http://www.website.com/very/long/path"

What is the html version of the below?
Code:
foo=http://www.website.com/very/long/path
<a href="$foo/page1.htm">Page 1</a>
<a href="$foo/page2.htm">Page 2</a>
<a href="$foo/page3.htm">Page 3</a>
 
Old 09-04-2019, 04:58 PM   #2
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.6
Posts: 3,635

Rep: Reputation: 1205Reputation: 1205Reputation: 1205Reputation: 1205Reputation: 1205Reputation: 1205Reputation: 1205Reputation: 1205Reputation: 1205
Quote:
Originally Posted by motherboard View Post
Code:
<a href="http://www.website.com/very/long/path/page1.htm">Page 1</a>
<a href="http://www.website.com/very/long/path/page2.htm">Page 2</a>
<a href="http://www.website.com/very/long/path/page3.htm">Page 3</a>
The above requires me to keep inserting
"http://www.website.com/very/long/path"

What is the html version of the below?
Code:
foo=http://www.website.com/very/long/path
<a href="$foo/page1.htm">Page 1</a>
<a href="$foo/page2.htm">Page 2</a>
<a href="$foo/page3.htm">Page 3</a>
If every link in the document is at the foreign url, use <base> in the <head> section:
Code:
<head>
  <base href="http://www.website.com/very/long/path/" target="_blank">
</head>

<body>
<a href="page1.htm">Page 1</a>
...
</body>
See: https://www.w3schools.com/tags/tag_base.asp

Note that that may not work with the /very/long/path/ part ins the <base> tag. I haven't tried it.

Last edited by scasey; 09-04-2019 at 04:59 PM.
 
1 members found this post helpful.
Old 09-04-2019, 05:00 PM   #3
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 9,094

Rep: Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931Reputation: 3931
I hate to give a "go google it" answer, but I think a search for "static site generator" might be what you're looking for.
 
1 members found this post helpful.
Old 09-05-2019, 01:39 PM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 12,307
Blog Entries: 9

Rep: Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309Reputation: 3309
Quote:
Originally Posted by motherboard View Post
What is the html version of the below?
Code:
foo=http://www.website.com/very/long/path
<a href="$foo/page1.htm">Page 1</a>
<a href="$foo/page2.htm">Page 2</a>
<a href="$foo/page3.htm">Page 3</a>
PHP.

Though scasey's advice looks very good, too.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I made a global shortcut to block an unwanted in-application shortcut newbiesforever LinuxQuestions.org Member Success Stories 0 07-22-2018 07:49 PM
Physical link vs Relative link vs Symbolic link hack3rcon Linux - Newbie 13 01-13-2018 10:48 AM
[KDE]Shortcut Icons smaller, Shortcut And Tray icons on 2 lines xeross Linux - Newbie 2 04-10-2008 10:20 AM
How to create symbolic link to html file and avoid page link problem? haxpor Linux - General 2 01-29-2008 07:40 AM
skge: eth0: Link is up... Link is down... Link is up.... sugar2 Linux - Hardware 5 07-03-2007 03:52 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration