<svg class="icon">
<use xlink:href="#home-icon"></use>
</svg>
import MyIcon from './assets/icons/iconsall.svg'
<svg class="icon">
<use xlink:href="#home-icon"></use>
</svg>
<svg class="icon">
<use xlink:href="icons.svg#home-icon"></use>
</svg>
<symbol id="icon-ogo1l" viewBox="0 0 32 32">
<path d="M5.286 2.675c-1.254 0.422-2.125 1.267-2.534 2.458-0.269 0.742-0.243 1.984 0.051 2.611 0.448 0.986 11.942 20.992 12.237 21.299 0.192 0.192 0.486 0.32 0.858 0.358 0.512 0.064 0.627 0.026 0.96-0.294 0.218-0.205 1.126-1.638 2.035-3.187 0.896-1.549 2.33-4.019 3.187-5.504s2.778-4.787 4.275-7.334c1.485-2.56 2.79-4.915 2.893-5.222 0.307-0.909 0.243-2.163-0.141-2.995-0.358-0.781-1.062-1.574-1.651-1.882-1.011-0.538-1.254-0.55-11.584-0.55-9.19 0.013-9.971 0.026-10.586 0.243zM14.592 13.978c0 5.171-0.051 8.55-0.115 8.486-0.064-0.077-1.139-1.907-2.394-4.096-1.242-2.189-3.264-5.722-4.48-7.846-1.229-2.138-2.227-4.019-2.227-4.186 0-0.154 0.115-0.435 0.269-0.627l0.256-0.333h8.691v8.602zM26.355 5.709c0.371 0.461 0.346 1.114-0.064 1.83-0.192 0.32-0.64 1.101-1.011 1.741-2.496 4.275-5.248 8.998-5.363 9.216-0.525 0.96-2.419 4.16-2.458 4.16-0.026 0-0.051-3.891-0.051-8.64v-8.64h8.691l0.256 0.333z"></path>
</symbol>
.icon {
width: 30px;
fill: #007bff;
}
<svg class="icon">
<use xlink:href="#home-icon"></use>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
<path d="M4.351 29.461s-.028.715.67.715l8.066-.009.012-6.61s-.114-1.09.944-1.09h3.347c1.251 0 1.174 1.09 1.174 1.09l-.014 6.588h7.896c.887 0 .847-.891.847-.891V17.069L16.165 7.171 4.352 17.069V29.46zM0 16.148s1.003 1.849 3.191 0L16.263 5.089l12.256 10.99c2.532 1.826 3.481 0 3.481 0L16.263 1.824zM28.222 5.063h-3.153l.013 3.823 3.14 2.663z"></path>
</svg>
<img src="/src/assets/icons/02-home-page.svg" alt="Домой" title="Перейти на главную страницу">
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="home-icon" viewBox="0 0 32 32">
<path d="M4.351 29.461s-.028.715.67.715l8.066-.009.012-6.61s-.114-1.09.944-1.09h3.347c1.251 0 1.174 1.09 1.174 1.09l-.014 6.588h7.896c.887 0 .847-.891.847-.891V17.069L16.165 7.171 4.352 17.069V29.46zM0 16.148s1.003 1.849 3.191 0L16.263 5.089l12.256 10.99c2.532 1.826 3.481 0 3.481 0L16.263 1.824zM28.222 5.063h-3.153l.013 3.823 3.14 2.663z"></path>
</symbol>
</svg>
<svg class="icon">
<use xlink:href="#home-icon"></use>
</svg>
<img src="assets/logo-letters.svg?component" alt="" title="">
<?xml version="1.0" encoding="utf-8"?>
<!-- Generated by IcoMoon.io -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="752" height="128" viewBox="0 0 752 128">
<svg id="icon-ogo1l" width="32" height="32" viewBox="0 0 32 32" x="0" y="0">
<path d="M5.286 2.675c-1.254 0.422-2.125 1.267-2.534 2.458-0.269 0.742-0.243 1.984 0.051 2.611 0.448 0.986 11.942 20.992 12.237 21.299 0.192 0.192 0.486 0.32 0.858 0.358 0.512 0.064 0.627 0.026 0.96-0.294 0.218-0.205 1.126-1.638 2.035-3.187 0.896-1.549 2.33-4.019 3.187-5.504s2.778-4.787 4.275-7.334c1.485-2.56 2.79-4.915 2.893-5.222 0.307-0.909 0.243-2.163-0.141-2.995-0.358-0.781-1.062-1.574-1.651-1.882-1.011-0.538-1.254-0.55-11.584-0.55-9.19 0.013-9.971 0.026-10.586 0.243zM14.592 13.978c0 5.171-0.051 8.55-0.115 8.486-0.064-0.077-1.139-1.907-2.394-4.096-1.242-2.189-3.264-5.722-4.48-7.846-1.229-2.138-2.227-4.019-2.227-4.186 0-0.154 0.115-0.435 0.269-0.627l0.256-0.333h8.691v8.602zM26.355 5.709c0.371 0.461 0.346 1.114-0.064 1.83-0.192 0.32-0.64 1.101-1.011 1.741-2.496 4.275-5.248 8.998-5.363 9.216-0.525 0.96-2.419 4.16-2.458 4.16-0.026 0-0.051-3.891-0.051-8.64v-8.64h8.691l0.256 0.333z"></path>
</svg>
const { createApp } = Vue
const { createRouter, createWebHistory } = VueRouter
const { useTitle } = window.VueUse
// Функция для загрузки шаблонов
function loadTemplate(url) {
return fetch(url)
.then(response => response.text())
.catch(() => '<div>Ошибка загрузки контента</div>')
}
// Компонент для главной страницы
const Home = {
setup() {
const title = useTitle('Главная страница') // Устанавливаем заголовок
return { title }
},
async mounted() {
this.content = await loadTemplate('/main.php')
},
template: `<div v-html="content"></div>`,
}
// Компонент для страницы контактов
const Contacts = {
setup() {
const title = useTitle('Контакты') // Устанавливаем заголовок
return { title }
},
async mounted() {
this.content = await loadTemplate('/contacts.php')
},
template: `<div v-html="content"></div>`,
}
// Настройка маршрутов
const routes = [
{ path: '/', component: Home },
{ path: '/contacts', component: Contacts },
]
// Создание роутера
const router = createRouter({
history: createWebHistory(),
routes,
})
// Глобальное отслеживание изменения маршрута
router.afterEach(to => {
const title = to.meta.title || 'Мой сайт' // Используйте meta-поля в маршрутах
useTitle(title) // Обновляем заголовок
})
// Создание Vue приложения
createApp({}).use(router).mount('#app')
const { createApp } = Vue
const { createRouter, createWebHistory } = VueRouter
const { useTitle } = window.VueUse
// Функция для загрузки шаблонов
function loadTemplate(url) {
return fetch(url)
.then(response => response.text())
.catch(() => '<div>Ошибка загрузки контента</div>')
}
// Компонент для главной страницы
const Home = {
setup() {
const title = useTitle('Главная страница') // Устанавливаем заголовок
return { title }
},
async mounted() {
this.content = await loadTemplate('/main.php')
},
template: `<div v-html="content"></div>`,
}
// Компонент для страницы контактов
const Contacts = {
setup() {
const title = useTitle('Контакты') // Устанавливаем заголовок
// Устанавливаем description и keywords
const metaDescription = document.querySelector('meta[name="description"]')
const metaKeywords = document.querySelector('meta[name="keywords"]')
if (metaDescription) {
metaDescription.setAttribute('content', 'Описание главной страницы')
}
if (metaKeywords) {
metaKeywords.setAttribute('content', 'нумерология, калькуляторы, главная')
}
return { title }
},
async mounted() {
this.content = await loadTemplate('/contacts.php')
},
template: `<div v-html="content"></div>`,
}
// Настройка маршрутов
const routes = [
{
path: '/',
component: Home,
meta: {
title: 'Главная страница',
description: 'Описание главной страницы',
keywords: 'нумерология, калькуляторы, главная',
},
},
{
path: '/contacts',
component: Contacts,
meta: {
title: 'Контакты',
description: 'Описание страницы контактов',
keywords: 'нумерология, контакты',
},
},
]
// Создание роутера
const router = createRouter({
history: createWebHistory(),
routes,
})
// Глобальное отслеживание изменения маршрута
router.afterEach(to => {
// Устанавливаем заголовок страницы
const title = to.meta.title || 'Нумерология - калькуляторы'
useTitle(title)
// Устанавливаем description и keywords
const metaDescription = document.querySelector('meta[name="description"]')
const metaKeywords = document.querySelector('meta[name="keywords"]')
if (metaDescription) {
metaDescription.setAttribute(
'content',
to.meta.description || 'Описание по умолчанию'
)
}
if (metaKeywords) {
metaKeywords.setAttribute(
'content',
to.meta.keywords || 'ключевые слова по умолчанию'
)
}
})
// Создание Vue приложения
createApp({}).use(router).mount('#app')