mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
Change all heading links to copy-links
This commit is contained in:
+1
-1
@@ -63,7 +63,7 @@ watch = true
|
||||
# Add GA Tracking Code Here. This leverages a built-in (ie, "internal") partial from HUGO: https://gohugo.io/extras/analytics#configuring-google-analytics
|
||||
googleanalyticstrackingcode = ""
|
||||
## Critical Render Path. If true, site style will be embedded in a <style> tag in each html <head> as part of Gulp Build. False puts a typical <link> to the stylesheet in <head>>
|
||||
usecrp = true
|
||||
usecrp = false
|
||||
## Twitter handle without the "@"
|
||||
twitterhandle = "GoHugoIO"
|
||||
## Facebook URL
|
||||
|
||||
@@ -20,7 +20,7 @@ Over time, dynamic site generators were programmed to cache their HTML files to
|
||||
|
||||
Hugo is in a family of generators that take caching a step further. All HTML files are rendered on your computer. You can review the files locally before copying them to the computer hosting the HTTP server. Since the HTML files aren't generated dynamically, we say that Hugo is a *static site generator*.
|
||||
|
||||
Not running a website generator on your HTTP server has many benefits. The most noticeable is performance. HTTP servers are *very* good at sending files---so good, in fact, that you can effectively serve the same number of pages with a fraction of the memory and CPU needed for a ~~dynamic site~~.
|
||||
Not running a website generator on your HTTP server has many benefits. The most noticeable is performance. HTTP servers are *very* good at sending files---so good, in fact, that you can effectively serve the same number of pages with a fraction of the memory and CPU needed for a dynamic site.
|
||||
|
||||
## More on Static Site Generators
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<head>
|
||||
<!-- - partial "head/metadata-schemaorg.html" . - -->
|
||||
{{- partial "head/noindex.html" . -}}
|
||||
{{- partial "head/metadata-refreshredirect.html" . -}}
|
||||
{{- partial "head/metadata-standard.html" . -}}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,10 +1,48 @@
|
||||
$('document').ready(function() {
|
||||
$('.body-copy a[href$=".pdf"]').append('<i class="icon-pdf"></i>');
|
||||
$('.body-copy > h2:not(.section-heading),.body-copy > h3').each(function() {
|
||||
var id = $(this).attr('id');
|
||||
// var baseurl = window.location.origin,
|
||||
// path = window.location.pathname,
|
||||
// fullurl = `${baseurl}${path}#${id}`;
|
||||
$(this).prepend(`<a class="smooth-scroll heading-link" href="#${id}"><i class="icon-link"></i></a>`);
|
||||
var id = $(this).attr('id'),
|
||||
loc = window.location.href.split('#')[0];
|
||||
$(this).prepend(`<a class="smooth-scroll heading-link" href="#${id}" copy-text="${loc}#${id}"><i class="icon-link"></i></a>`);
|
||||
});
|
||||
});
|
||||
// $('.heading-link').on('click',function(evt){
|
||||
// evt.preventDefault();
|
||||
// evt.stopPropagation();
|
||||
// });
|
||||
// var headingLink = new Clipboard('.heading-link');
|
||||
// headingLink.on('success', function(e) {
|
||||
// e.trigger.classList.add('copied');
|
||||
// var x = window.scrollX;
|
||||
// var y = window.scrollY;
|
||||
// setTimeout(function() {
|
||||
// window.scrollTo(x, y);
|
||||
// }, 0);
|
||||
// e.clearSelection();
|
||||
// });
|
||||
$('.heading-link').on('click', function(evt) {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
var targ = $(this),
|
||||
text = $(this).attr('copy-text'),
|
||||
// set target to anchor's "href" attribute
|
||||
target = $(this).attr('href'),
|
||||
hashid = target.split('#')[1],
|
||||
textField = document.createElement('textarea');
|
||||
// scroll to each target
|
||||
$(target).velocity('scroll', {
|
||||
duration: 500,
|
||||
offset: -80,
|
||||
easing: 'ease-in-out'
|
||||
});
|
||||
location.hash = hashid;
|
||||
textField.innerText = text;
|
||||
document.body.appendChild(textField);
|
||||
textField.select();
|
||||
document.execCommand('copy');
|
||||
$(textField).remove();
|
||||
$(this).addClass('copied');
|
||||
setTimeout(function() {
|
||||
targ.removeClass('copied');
|
||||
}, 600);
|
||||
})
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
$(document).ready(function() {
|
||||
// bind click event to all internal page anchors
|
||||
$('a.heading-link,#toc a').on('click', function(e) {
|
||||
$('#toc a').on('click', function(e) {
|
||||
// prevent default action and bubbling
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
@@ -15,4 +15,4 @@ $(document).ready(function() {
|
||||
});
|
||||
location.hash = hashid;
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -72,6 +72,7 @@
|
||||
.icon-download:before { content: '\e806'; } /* '' */
|
||||
.icon-edge:before { content: '\f282'; } /* '' */
|
||||
.icon-file-pdf:before { content: '\f1c1'; } /* '' */
|
||||
.icon-pdf:before { content: '\f1c1'; } /* '' */
|
||||
.icon-firefox:before { content: '\e840'; } /* '' */
|
||||
.icon-forum:before { content: '\f03d'; } /* '' */
|
||||
.icon-forums:before { content: '\f03d'; } /* '' */
|
||||
|
||||
@@ -90,9 +90,26 @@ a.tooltip {
|
||||
display: inline;
|
||||
top: .35em;
|
||||
right: 0px;
|
||||
@include size(1.2em);
|
||||
@include MQ(M) {
|
||||
left: -1.5em;
|
||||
}
|
||||
&:hover:after {
|
||||
content: 'Copy Link';
|
||||
display: inline-block;
|
||||
width: 70px;
|
||||
background-color: $hugo-black;
|
||||
color: $hugo-white;
|
||||
font-size: 12px;
|
||||
position: absolute;
|
||||
bottom: -1.5em;
|
||||
border-radius: 3px;
|
||||
left: -1em;
|
||||
text-align: center;
|
||||
}
|
||||
&.copied:hover::after {
|
||||
content: 'Copied!';
|
||||
}
|
||||
}
|
||||
h2,
|
||||
h3 {
|
||||
@@ -102,7 +119,7 @@ a.tooltip {
|
||||
opacity: 1;
|
||||
}
|
||||
.icon-link:hover {
|
||||
color:$hugo-pink;
|
||||
color: $hugo-pink;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+3
-3
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user